Hi there I am trying to read from a file,
I am trying to read certain fields,there are 6 fields in this file like
--------/--------/--------/--------/--------/--------/
All fields are 8 characters width and I am comparing the first
character of the line with the $ sign which seperates different blocks
of information
$ Nodes of the Entire Model
GRID 1 .25 .25 0.
GRID 2 .2 .25 0.
GRID 3 .15 .25 0.
GRID 4 .1 .25 0.
GRID 5 .05 .25 0.
GRID 6 0. .25 0.
GRID 7 .25 .2 0.
GRID 8 .2 .2 0.
GRID 9 .15 .2 0.
GRID 10 .1 .2 0.
GRID 11 .05 .2 0.
GRID 12 0. .2 0.
GRID 13 .25 .15 0.
GRID 14 .2 .15 0.
GRID 15 .15 .15 0.
GRID 16 .1 .15 0.
GRID 17 .05 .15 0.
GRID 18 0. .15 0.
GRID 19 .25 .1 0.
GRID 20 .2 .1 0.
$ Loads for Load Case : Default
I can read the first line of the input which is GRID 1 .... and
the result is 'G'
after that reading the first charecter(control_char in the code) on the
newline results in (-1 and y with two dots on top of y) I could not
figure out my problem. My code for this part is
..
..
..
while(inoutFile.getline(linein,80,'\n')){
if(strcmp(linein,"$ Nodes of the Entire Model") == 0){
while((control_char=inoutFile.get()) != '$'){ // read until
the other block
inoutFile.ignore(std::numeric_limits<std::streamsi ze>::max(),'\n');
}
}
if(control_char=='$')
break;
}
..
..
..
Can there be a problem related with binary and text files? Because the
file I am trying to read is the output of a package program and I do
not know the newline characters that are used to these files. (I also
tried it with a file that I know the newline character is '\n', the
same problem still persists with the file I created myself as well :-((
)
Any help will be appreciated.
Thanks.