[Dev-C++] [Dec-C++]eof() function and type variable from file input
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: carlos D. M. <cg...@wo...> - 2001-11-10 17:58:28
|
Hi again:
I am writing a program for make a two weeks work in one minute, and it
will take me two months...
I have a .txt archive with various tables of diferent amount of rows,
and always five columns; I need a program which the first five data are
sent to a char * variable; the next 5*n values to a float [5] and write
them in other archive as I need them, after one data which is char *,
made by letters and numbers, being the first a letter.
Well: I try it writing what I must write but:
a) If I use while(!inputFile.eof()){
the body of all the instructions needed
}
When I run the program, immediately,
when it's the moment of reading the inputFile **the program has
generated an error log and it wwill be closed by windows**
b) If I try something like for(as many times as tables it must
pass) I find that it doesn't recognize the type of the data:
The first is a while(inputFile >> charvariable); what i want do with
them; while(inputFile >> floatvariable); what I want do with them, with
the correspondent variable arrays with the suscripts and counters, etc;
and inputFile >> thelastcharofthetable);what I want do; Then I found the
program:
b.1) ***generated error.log bla bla guauau****
b.2) It considered all data as char, and soit did for every data of
the txt file the same, what I want for the first five words.
Are there any function hich lets the program know if the data from input
file is float or char or int and once known use that data for the
correct instruction? Or it is best to do it by hand, killing the
computer and suiciding myself?
I hope this is a problem for be console program, so I will be able to
write the program I think i will need write in the future. But I think,
that although the main are the windows programs, the console ones would
be good to have a good work.
Now I don't need that hard program and it would be very, very useful can
program some little consoles. And if I can write the program five
minutes and do what I need in three seconds (I don't worry very much now
about efficiency, I write for myself) and avoid do it by hand in weeks
of giant boring waste of time.
Thanks to anybody who can help.
Thanks to everybody who will find this message occupying memory, for
their patience.
Thanks if Dev-C++ 5 solve this problems(if it is really a problem of the
progran and not my inexperience) (And thanks either if not).
|