68 Posted Topics

Member Avatar for mybluehair

You may read data from anyone line in the file. But it's not working for writing. If your file is empty, y can write from begin to end. And if your file is not empty, y can add data in the end of file.

Member Avatar for Protuberance
0
83
Member Avatar for jko2326

For reading data both int and char types you can use fscanf() function, or ifstream. Ifstream has overloaded operator >> for many types.

Member Avatar for Protuberance
0
151
Member Avatar for Yee

Hmm... It's to simple. I think, you can try do like this [code=cpp] class Test { public: int x; Test(int v = 0) :x(v) //default value {} }; [/code]

Member Avatar for mrnutty
0
106
Member Avatar for hemant_chawla89

If you add some resources to your project, environment must include "Resource.h" automativally. You create resources or using complete?

Member Avatar for hemant_chawla89
0
89
Member Avatar for imwan

I think you have to try place freeing memory code into the "try{...}catch()" block. Because you allocate memory inside the try{}catch block, and free the memory outside of it. If you raised an exception in allocating memory, and then try to free that memory you have raise the new exception. …

Member Avatar for DdoubleD
0
1K
Member Avatar for Schoorsteen

Try to check clSockAddr variable, because an error talks that an address is inaccessible. Maybe port or IP equals 0. The best solution in this case - debug mode. Place breakpoints and watch the values of variables. P.S. or maybe firewall blocks incoming connections.

Member Avatar for Schoorsteen
0
396
Member Avatar for gretty

[B]The first error:[/B] s[i] - is not a string, is a char [B]Second:[/B] inserting must be into begin, not into the end, so code [code=cpp] s[i].insert( s[size-1] ); [/code] is fully incorrect [B]Third:[/B] Function [B]insert[/B] has many overloads, but it's no [B]string insert(char);[/B] Correct code [code=cpp] string reverse(string s) { …

Member Avatar for mrnutty
0
202
Member Avatar for sara9111
Member Avatar for lotrsimp12345

try to use debug. Place breakpoint at the lines you thought you have error(s) and check the varibles values.

Member Avatar for lotrsimp12345
0
114
Member Avatar for Pikachumanson

If I understood you correctly, if you want to change font of text, just use global variable of font color. And when you press the space bar, change your font to default and call repaint method, or send WM_PAINT message to the main window.

Member Avatar for Pikachumanson
0
128
Member Avatar for jko2326

If you read the data and occur EOF, than your last line will be missed try to type this [code=cpp] void ProcessLoop(void) { InputRecord(); // input grade record while (!gradeFile.eof()) { ComputeAvr(); // compute average grade PrnDetail(); // print detail line InputRecord(); // input grade record } ComputeAvr(); PrnDetail(); return; …

Member Avatar for jko2326
0
137
Member Avatar for hayatihamid

[code=cpp] while (!myReadFile.eof()) { myReadFile>>x>>y; xVal.push_back(x); yVal.push_back(y); } cout<<xVal.size()<<endl; // try this myReadFile.close(); [/code]

Member Avatar for hayatihamid
0
3K
Member Avatar for atch

You have two same functions in class [code=cpp] class Object { protected: enum ID {OBJECT, CAVE, MONSTER, WUMPUS, HERO, GUN, BAT}; //maybe it better place outside the class? Coordinates* _my_coordinates; void id(ID id) //first declaration { this->_my_id = id; } public: explicit Object(s_int coordinate_x = 0, s_int coordinate_y = 0); …

Member Avatar for jesseb07
0
107
Member Avatar for daviddoria

you can place your array into private, and just initialize values in constructor Example [code=cpp] class MyClass { public: MyClass() { DefaultForward[0] = 0.0; DefaultForward[1] = 1.0; DefaultForward[2] = 0.0; } private: double DefaultForward[3]; } [/code]

Member Avatar for daviddoria
0
152
Member Avatar for lotrsimp12345

I don't understand this code [code=cpp] void Frame_The_Phrase::open_file() { string input; cout<<"enter file name which needs to be opened\n"; cin>>input; in.open(input.c_str()); while(!in) { in.close(); cout<<"the input textfile failed please reenter the file\n"; in.clear(); cin>>input; in.open(input.c_str()); } cout<<"the file opened\n"; } [/code] try to type this [code=cpp] ifstream& Frame_The_Phrase::open_file() { string …

Member Avatar for lotrsimp12345
0
158
Member Avatar for rip_snoopy

use strcmp() to compare first field in each record and use bubblesort. or use std::vector, or std::list to keep your data Smth like this: [code=cpp] struct SubjectRecord { char *CourseCode; char *CourseName; char *SubjectArea; int TeacherID; time_t Date; //you can use your own class of time int NoEnrolled; int Support; …

Member Avatar for VernonDozier
0
114
Member Avatar for kiel19

You can use MFC Example [code=cpp] #include <WinInet.h> #pragma comment(lib, "wininet") class CHTTP { public: CHTTP(LPCTSTR lpszServerName, LPCTSTR lpszTarget, int Method, LPCTSTR lpszFileName); CHTTP(); ~CHTTP(); public: bool OpenInet(LPCTSTR lpszAgent); // creating connection lpszServerName hostname e.g. "google.com" bool Connection(LPCTSTR lpszServerName); void CloseOpenedInet(); void CloseConection(); bool CheckError(bool bTest); DWORD m_dwLastError; HINTERNET m_hInternet; …

Member Avatar for Protuberance
0
383
Member Avatar for licktress

you also can use gets() [code]char *str = new char[128]; gets(str);[/code] or change a EOS symbol [code] char *str = new char[128]; cin.getline(str, 128, '\n'); //instead '\n' type your EOS symbol e.g. '$' [/code]

Member Avatar for Protuberance
0
261

The End.