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!
chester1908
0
Newbie Poster
Recommended Answers
Jump to Post>>.any ideas?
Any ideas about what? You sort of lot me with all that description.
All 2 Replies
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
Murtan
317
Practically a Master Poster
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.