2,025 Topics

Member Avatar for
Member Avatar for MasterHacker110

I have this code and when ever i try to put in the value 'e' it doesnt want to take it, the program freses. #include <iostream> #include <string> #include <fstream> using namespace std; int encrypt(); int decrypt(); int phi, M, n, e, d, C, N, D, answer, p, q, s; …

Member Avatar for MasterHacker110
0
130
Member Avatar for SyncMr

0 down vote favorite I have a huge vector of boost dynamic_bitset. I want to write the dynamic_bitset vector to a file and later read the file back into a dynamic_bitset vector. Is the memory for dynamic_bitset allocated as a contiguous block of memory (so that I can write the …

Member Avatar for NathanOliver
0
2K
Member Avatar for MasterHacker110

I have this encryption code, it encrypt the file but doesnt want to decrypt it: it gives a segmentation fault error. By the way i am using linux... #include <iostream> #include <string> #include <fstream> #include <cstdlib> #include <sstream> #include <vector> using namespace std; int n, c, l; void gen_code(string word1, …

Member Avatar for MasterHacker110
0
2K
Member Avatar for DeeperShade

Ok, first post. Ive tried to avoid asking for help when i've had problems before and usually managed to solve things on my own but on this, i'm just going round in circles. I'm trying to teach myself basic directx9 and so far I made a program that takes a …

Member Avatar for DeeperShade
1
271
Member Avatar for happygeek

![bomb021](/attachments/small/0/bomb021.jpg "align-right") "There are bombs littered all over the city and your job is to stop them from exploding" that's the premise of Bomb Disposal Unit 54, a new game that I have been playing on my iPad before it's official release in the App Store on 6th May. When …

Member Avatar for Daniel Jones
0
242
Member Avatar for learner_new

#include<iostream> #include<fstream> #include<string.h> using namespace std; int main() { //system("clear"); cout<<"\npls input the file where you want to read the data from\n"; string loc; getline(cin,loc); ifstream g; g.open (loc.c_str(),ios::in); string data; g>>data; cout<<"\n\n\n\n"; cout<<"\nthe data read from the file is\n"; cout<<endl<<data; return 0; } > even if fiole being read …

Member Avatar for learner_new
0
235
Member Avatar for Code_Geek

I have a problem with the following code.Please help me out #include<stdio.h> #include<iostream> #include<conio.h> #include<winsock.h> #include<winsock2.h> #include<fstream> #include<windows.h> #define WIN32_MEAN_AND_LEAN #include <sys/types.h> #include <streambuf> #include<string.h> using namespace std; int main() { int length; char *buffer; const int iReqWinsockVer = 2; WSADATA wsaData; if (WSAStartup(MAKEWORD(iReqWinsockVer,0),&wsaData)==0) { if (LOBYTE(wsaData.wVersion) >= iReqWinsockVer) { …

Member Avatar for triumphost
0
410
Member Avatar for кодирование

First of all, just registered and this forum looks great! PROBLEM: My program which I wrote in Code::Blocks, has compiled fine and has worked fine, but when I run the outputted file called (BINDED.exe) it shows a very quick console window then closes, I think this is due to the …

Member Avatar for georgeduroa
0
175
Member Avatar for limeramen22

Hi. So I have a website (SNIP) and I am setting up a phpBB forum (or something else). But......I'm going mobile-style! Is there anyway I can make it so anytime a new post comes up (assuming the person is on the website), the person gets a push notification or something? …

Member Avatar for Daniel Jones
0
160
Member Avatar for Dudearoo

**Dudearoo** *Useing Code::Blocks* ok, ive got a somewhat simple error that i cant crack, First heres my code. #include <iostream> #include <cstdlib> #include <stdio.h> #include <time.h> #include <conio.h> #include <stdlib.h> #include <iomanip> #include <windows.h> // so to use strcmp #include <cstring> #include <fstream> using namespace std; int main() { ofstream …

Member Avatar for Lucaci Andrew
0
650
Member Avatar for Patiodude

I'm a PHP newbie, and I need to replace my current code for linking to a stylesheet (which looks like `<link rel="stylesheet" href="/style.css" type="text/css"> `) by a PHP alternative. If it's important, the code I'm using which will link to it is [php-mobile detect](http://code.google.com/p/php-mobile-detect/). The structure I wanted to use …

Member Avatar for veedeoo
0
200
Member Avatar for Dudearoo

**Dudearoo** *Useing Code::Blocks* Hey you guys! ive got a problem with a 'test' program i have made for saveing strings. heres the code: #include <iostream> #include <cstdlib> #include <stdio.h> #include <time.h> #include <conio.h> #include <stdlib.h> #include <iomanip> #include <windows.h> #include <fstream> using namespace std; int main() { ofstream myfile ("savefile.txt", …

Member Avatar for Dudearoo
0
141
Member Avatar for boris90

Hi, I need a program to search all lines of a file (a whole file) for a certain string. In my concrete case, I need it for login. Let me sum all of this up, so you get the whole overall point of what I have so far: - a …

Member Avatar for Moschops
0
663
Member Avatar for Kerry W

My mother always said that precious things are often small, and after using this product I couldn’t agree more! Installed, the Power2U USB ![118](/attachments/small/3/118.JPG "align-right") outlet looks just like a normal outlet but don’t let that fool you. This small gem is quite big in its infinite uses; whether its …

0
678
Member Avatar for dyl_ham

This is a school assignment. I have to write a function in my program that opens a file stream and returns a heaped value to the main function. I believe the file opening function works but after it passes the ifstream pointer to the main function, I'm having trouble dereferencing …

Member Avatar for dyl_ham
0
1K
Member Avatar for Sendy Hipo

hi, i have problems with static member function the compiler's problems = "undefined reference" **Design a class Numbers that can be used to translate whole dollar amounts in the range 0 through 9999 into an English description of the number. For example, the number 713 would be translated into the …

Member Avatar for Sendy Hipo
0
712
Member Avatar for JE821

So the program makes an inventory from a cvs file. The cvs file consists of dvds and books. here is the code: #include "StdAfx.h" #define _CRTDBG_MAP_ALLOC //for memory checking #include <iostream> #include <stdlib.h> #include <crtdbg.h> #include <iomanip> #include <fstream> #include <string.h> #pragma warning(disable: 4996 4018) using namespace std; #define COPYSTR(TARGET, …

Member Avatar for JE821
0
402
Member Avatar for warzaru

Hello, after I have friendet my class to "<" operator it dosn't work after i use sort over an vector of class instances it does nothing: class + main : class RAngle{ public: int x,y,l; RAngle(){ } RAngle(int i,int j,int k){ x=i,y=j,l=k; } bool operator<(const RAngle& rhs)const { if(l < …

Member Avatar for Lucaci Andrew
0
327
Member Avatar for triumphost

Why does the below crash? My pointer is still alive and is constructed in the main so it should not die until main returns :S I was using this with createthread a while back but my Mingw4.5 never supported it. I just upgraded to 4.7 but now this crashes and …

Member Avatar for triumphost
0
1K
Member Avatar for triumphost

I have a header file that I include into my main.cpp file. I want to set some flags when this file is included. std::cout.flags(std::ios::boolalpha); I want to set that automatically how can I do this? I tried: #ifdef DEFINES_HPP_INCLUDED std::cout.flags(std::ios::boolalpha); #endif //Gives me the error: //error: 'cout' in namespace 'std' …

Member Avatar for mike_2000_17
0
131
Member Avatar for AnthonyFu

![145](/attachments/small/3/145.jpg "align-left") The LaserJet Pro 400 MFP M475dn is the newest entry into the all-in-one printer market from HP. It is a color LaserJet which scans up to 4.5 inches per minute (ipm) in color and 11.5 ipm in black. This device will copy, fax and print up to 21 …

0
350
Member Avatar for Sendy Hipo

i have this problem to write and read data, here's what im trying to make : Write a program that uses a structure to store the following inventory data in a file: -Item Description -Quantity on Hand -Wholesale Cost -Retail Cost -Date Added to Inventory The program should have a …

Member Avatar for Sendy Hipo
0
614
Member Avatar for Clouded One

hi its me again, same program new problem... been working on this all day and i just cannot get it to work. #define INVENTORY_H #include <iostream> #include <iomanip> #include <string> #include <istream> #include <fstream> #include <vector> #include <ctime> using namespace std; class Inventory { private: static const char *Error[]; static …

Member Avatar for Clouded One
0
180
Member Avatar for Clouded One

hello, i am new to this site but i have used it as reference before. this is a program for one of my classes and i have everything done down to one error... error LNK2001: unresolved external symbol "private: static char const * * Inventory::Error" (?Error@Inventory@@0PAPBDA) 1>C:\Users\Joey\documents\visual studio 2010\Projects\JHabura PA …

Member Avatar for Clouded One
0
147
Member Avatar for OrangeTree

Hi :). I use this code to create a file: #include <cstdlib> #include <fstream> using namespace std; int main () { ofstream file("main/articles/giraffe/article.txt", ios::out); file.close (); return 0; } How can I simplify **create path of folders** (on **unix system**) "main/articles/giraffe/" - if folder "main" doesn't exist? With using standard …

Member Avatar for OrangeTree
0
245
Member Avatar for Sendy Hipo

so i made this code that asks the user about corporate's data(division's name, sales, etc) #include <iostream> #include <string> #include <fstream> using namespace std; const int SIZE = 4; struct Division { string name; string quarter[SIZE]; double sales[SIZE]; }; void getData(Division []); int main() { Division corp[SIZE]; for(int count = …

Member Avatar for Sendy Hipo
0
183
Member Avatar for Sendy Hipo

hi, i have this problem about reading the file's content from the back Write a program that asks the user for the name of a file. The program should display the last 10 lines of the file on the screen (the tail of the file). If the file has fewer …

Member Avatar for Sendy Hipo
0
1K
Member Avatar for Crynix

First things first, I'm relatively new to C++. I'm just finishing up my first semester of computer science and I'm getting the error "Segmentation Fault (core dumped)" while opening a file in my final. I believe the error has to do with pointers and occurs somewhere in the while(!file.eof()) { …

Member Avatar for histrungalot
0
351
Member Avatar for trishtren

hello, i am attemping to write a basic swf header reader using the format specification from : http://www.the-labs.com/MacromediaFlash/SWF-Spec/SWFfileformat.html So far i am able to read the first 3 bytes : FWS, no problem The problem i am having is reading the version number after, it is displayed as a question …

Member Avatar for WaltP
0
168
Member Avatar for Perigee

**Appcelerator releases Titanium 2.0 with suite of mobile cloud services.** On April 17th, 2012, Appcelerator took the wraps off of the latest release of their flagship product Titanium 2.0. This major point release of the seminal cross-platform mobile development environment brings with it a new suite of ready-to-use 'Instant Mobile …

0
242
Member Avatar for Sendy Hipo

hello, im newbie in c++ and i have some newbie questions. erm here's the problem ive been thinking : #include <iostream> #include <fstream> using namespace std; struct Info { string name; int age; }; int main() { Info person1, person2; fstream writefile("output.txt", ios::out | ios::binary); person1.name = "sendy"; person1.age = …

Member Avatar for Sendy Hipo
0
199
Member Avatar for Humayoon Khan

i know how to read a file into array, however i want to perform some search operations which is difficult to do on array. if someway i am able to read a file to string then it becomes easier. i have 2 methods of reading a file into wstring but …

Member Avatar for Humayoon Khan
0
3K
Member Avatar for Humayoon Khan

here is the code, that reads a file. Currently i am able to print contents of the file but i want to edit its contents. how can i do this? #include<iostream> #include<fstream> using namespace std; void main() { wfstream file; file.open("hello.exe",ios::binary | ios::in); if (!file) { cout<<"ERROR"<<endl; exit(0); } wcout<<file.rdbuf(); …

Member Avatar for Humayoon Khan
0
124
Member Avatar for Sendy Hipo

i read c++ ebook, then i make a code to open a file using fstream and use ios::in flag here's the code : #include <iostream> #include <fstream> using namespace std; bool openFileIn(fstream&, string); int main() { fstream dataFile; if(openFileIn(dataFile, "sendy.txt")) { cout<<"succes"; } else cout<<"fail"; return 0; } bool openFileIn(fstream …

Member Avatar for Sendy Hipo
0
154
Member Avatar for cresenia1988

Sorry, this might be abit of a rush and sudden. I have to finish this program in 3 hours time. I would appreciate if there's any kind soul willing to help me with the code. Thank you. Output of the program should be like this. Top popular 12 words 1 …

0
72
Member Avatar for Lucaci Andrew

Have some problems with the qt destructor. I'm working on QtCreator: here's the class: the .cpp #include "controller.h" Controller::Controller() { } Controller::Controller(MovieRepo *movrep, MovieValidator *movval){ this->movrep=movrep; this->movval=movval; } void Controller::addMov(int id, string title, string desc, string type)throw(ValidatorException){ Movie* mov=new Movie(id, title, desc, type); movval->validate(*mov); movrep->store(*mov); } const Movie* Controller::getById(int id){ …

Member Avatar for Lucaci Andrew
0
272
Member Avatar for tyggagucci

hie guys could anyone help me on how i can read a delimited file as i view all customer details #include <fstream #include <iostream> #include <string> using namespace std; int main () { int choice [1]; string name; string idnumber; string address; string surname; string FileName; fstream myfile; string line; …

Member Avatar for deceptikon
0
260
Member Avatar for BigEEter

Hi. I am wondering if a log file can be created in a header which is associated with a try-catch block. Below is my stripped down code for the log_header.h and log_test.cpp Here is log_header.h #include<fstream> #include<iostream> using namespace std; class thrower{ //fstream myfile2; public: void errormessage(); }; void thrower::errormessage(){ …

Member Avatar for BigEEter
0
394
Member Avatar for Nfurman

Hello guys, There's some issue with my UIPickerView controller. The data won't pop up in it. The 'Drum' by itself is visible but empty. My code is: - (void)viewDidLoad { [[self navigationController]setToolbarHidden:YES animated:YES]; [self setItemShow:theItem]; self.uiPickerViewData=[[[NSMutableArray alloc]initWithObjects:@"One",@"Two", nil]autorelease]; [super viewDidLoad]; } And method which will work when button is getting …

Member Avatar for scottdurica
0
1K
Member Avatar for nathaniscool99

Hello, I am trying to create a Login system, so far it writes users correctly however it doesn't seem to be reading it correctly as it always claims the username/password is incorrect even though when I check the file it is. Could someone help, thanks! class TestLogin { public: char …

Member Avatar for adityatandon
0
171
Member Avatar for nathaniscool99

Hello I am looking to read a file into a 2d array to show which spaces have been taken/ haven't taken whiey will show a # if not taken and a T if taken, so far I just have a text file I created which shows like this: T # …

Member Avatar for adityatandon
0
8K
Member Avatar for BigEEter

Hi. I am wondering if a log file can be created in a header which is associated with a try-catch block. Below is my stripped down code for the log_header.h and log_test.cpp Here is log_header.h #include<fstream> #include<iostream> using namespace std; class thrower{ fstream myfile2; public: void errormessage(); }; void thrower::errormessage(){ …

Member Avatar for JorgeM
0
244
Member Avatar for jakezcop

int Finish()//outputs stored values to file { ofstream walletfile; walletfile.open("C:/accounts/wallet.acnt", ios::trunc); walletfile << wallet; walletfile.close(); ofstream accountfile; accountfile.open("C:/accounts/account.acnt", ios::trunc); accountfile << account; accountfile.close(); ofstream savingsfile; savingsfile.open("C:/accounts/savings.acnt", ios::trunc); savingsfile << savings; savingsfile.close(); return 0; } I am a brand new programmer, just learning from the web, i wrote this function as …

Member Avatar for jakezcop
0
2K
Member Avatar for rotten69

Hey everyone, I'm working in a team on an IOS App and web app and the app relies on facebook pages to retrieve cafe names to let users check in the cafe they are at. But, the problem is that not all cafes have a facebook page.We would like to …

Member Avatar for rotten69
0
242
Member Avatar for Dalek Caan

Good day, all! I just joined DaniWeb and I am excited about the community. I am not new to programming (I was using C# when it was called COBOL :-)), but I am trying to update my skills and like the idea of having a "home" online where I can …

Member Avatar for mariary
0
200
Member Avatar for risen375

Hi I need help with this program. When I run this program, it will not print out the correct kilograms which always displays 0. Please help #include <iostream> #include <istream> #include <iomanip> #include <vector> using std::vector; using namespace std; using std::endl; using std::setw; struct PatientInfo { string name; double weight; …

Member Avatar for histrungalot
0
131
Member Avatar for haris riaz

void combination::OnButton2() { // TODO: Add your control notification handler code here m_progress.SetPos(0); m_progress.SetRange(0,100); combination a; a.make_combinations(0); } void combination:: make_combinations(int lo_val) { srand(time(0)); m_progress.StepIt(); ofstream fout("combination.txt",ios::app); ofstream fout2("time.txt",ios::app); for(int i=0; i<theApp.no_of_process; i++) { //m_progress.OffsetPos(100/4); //m_progress.SetStep(200); clock_t begin=clock(); arr[lo_val] = i; if(lo_val==(theApp.no_of_tasks)-1) { for( int j=0; j<theApp.no_of_tasks; j++) { int …

Member Avatar for ashishchoure
0
279
Member Avatar for Kirbyzdashiznit

**Description: Friend’s finder. You load a data file first. Then you answer 10 questions. The answers will be saved in an array. The data in file are several arrays answered by other users. You need to compare the answers with other users and calculate the similarity. After that it will …

Member Avatar for Kirbyzdashiznit
0
276
Member Avatar for apicante

Hello all, I am trying to make an employee program that takes in up to 100 max employees information then displays it back out nicely formatted, which I am not getting right and have been googling wtf I am doing wrong. Also I was wondering after inputting all the employee …

Member Avatar for gusano79
0
83
Member Avatar for NerdPC

I have googled this and I see how to do the clock function with insertion and I was pretty sure I implemented it right but the insertion sort never shows any time. I am not sure if I am not waiting long enough but I have had the program up …

Member Avatar for rubberman
0
224

The End.