Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: OctavariumXI on May 22, 2010, 04:28:33 AM

Title: Help with file loader
Post by: OctavariumXI on May 22, 2010, 04:28:33 AM
Aight, for the past week or so, I've been working on a custom-algorithm generated line-drawer, and just now I'm starting on a header file with the functions to load algorithms from a text file.

For some odd reason, whenever I use fscanf or fgetc, all it does is return a random integer or letter.

Here's the code;


FILE *file = fopen( "used_alg.alg" , "r+" );
while ( a <= 3 ){
        test = fgetc(file);
        cout << xres[a] << endl;
        ++a;}


In which xres[] is an integer array of 4.

Any reason why it's not working? >_<
Title: Re: Help with file loader
Post by: ollydbg on May 22, 2010, 04:50:54 AM
Please ask this question to some C/C++ forum. Codeblocks forum doesn't discuss these kind of questions.