Hey all.
(the reason i dont post code is a)because i think its far too long because the whole program is not just about that and b) because i think you might be able to help me w/o code,as it is kind of wierd problem)~~
So i wrote this program which basically opens a simple 5-line file,each line containing words and numbers,and what i wanted to do is separate and store each word and each number using an array for each of them.so i had array1[] for the first word,array2[] for the second etc and had some counters so that the program "knows" when to change the storing target.
at the end of my "while (c=fgetc(ptr)!=EOF)..." repeat,in which all the chars/numbers were stored in the arrays, i printed an array where i stored all numbers (i initialised this array at the beginning as 0),then system("pause"),return0;,}.(program ends).
so at first i give it a try,and i find out that only array1 stored its word correctly.however,the program ended regularly and the number board was printed as initialised,all 0s. Ofcourse i made a logical mistake.i corrected some of the counters and "if" conditions WITHIN the while repeat and when i ran it,the executable file 'blinked'.it run and dissapeared within a second.i planted some <system("PAUSE")> within the while repeat and i found out that this time all the words and numbers are stored correctly,however the program runs as if it ends right after the last repeat,ignoring the number array and the final system-pause.
This is the first time this happens to me...any ideas? thanks in advance!

>>.any ideas?
Any ideas about what? You sort of lot me with all that description.

Posting the code (in code tags) would have saved a lot of description of 'how you solved' the problem and given us a chance to actually help you.

I think I understand the symptoms of the problem fairly well (and that's a good thing to include when you're asking for help) but I don't understand what the code is doing or which part of the code you think is failing.

So post at least the part you think is having trouble, but the whole function involved would be better, and depending on the size and complexity of the file and/or the other parts of the file that the function interacts with, the entire file might not be out of line.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.