News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Help with file loader

Started by OctavariumXI, May 22, 2010, 04:28:33 AM

Previous topic - Next topic

OctavariumXI

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? >_<

ollydbg

Please ask this question to some C/C++ forum. Codeblocks forum doesn't discuss these kind of questions.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.