B
ben
Hi guyz,
Say a line "abcdef..." is written to a file.
The file is created like this :
ofstream fout;
fout.open("temp.dat");
fout<<str;//str is string with contents like abcd....
fout.close();
Now i open the file for reading using
ifstream fin;
fin.open("temp.dat");
The pointer will be by default positioned to the 0th byte of the
file(beginning of the file).
Now i want to find the letter 't' or say 'w' in that string.
The problem is i wont be knowing what is the size of the
string and where it ends.(The string is not null terminated.There might
be whitespace at the end).
I tried out all possible functions like fin.peek(),fin.ignore(MAX,'\n')
and so on but in vein.
Can anyone suggest a way out?(I can't use commands like find)
How do i find out what is stored in nth byte of the file?
bye,
ben
Say a line "abcdef..." is written to a file.
The file is created like this :
ofstream fout;
fout.open("temp.dat");
fout<<str;//str is string with contents like abcd....
fout.close();
Now i open the file for reading using
ifstream fin;
fin.open("temp.dat");
The pointer will be by default positioned to the 0th byte of the
file(beginning of the file).
Now i want to find the letter 't' or say 'w' in that string.
The problem is i wont be knowing what is the size of the
string and where it ends.(The string is not null terminated.There might
be whitespace at the end).
I tried out all possible functions like fin.peek(),fin.ignore(MAX,'\n')
and so on but in vein.
Can anyone suggest a way out?(I can't use commands like find)
How do i find out what is stored in nth byte of the file?
bye,
ben