LCKB
[Visual C++] Reading some char[] - Printable Version

+- LCKB (https://lckb.dev/forum)
+-- Forum: ** OLD LCKB DATABASE ** (https://lckb.dev/forum/forumdisplay.php?fid=109)
+--- Forum: Programmers Gateway (https://lckb.dev/forum/forumdisplay.php?fid=196)
+---- Forum: Coders Talk (https://lckb.dev/forum/forumdisplay.php?fid=192)
+---- Thread: [Visual C++] Reading some char[] (/showthread.php?tid=1974)



- Koko - 05-29-2013


Hey, me again ._.

 

This time i got a lil problem when it comes to read some chars.

Im atm trying to read the itemname file to get used of visual c++ express, but using the read function of fstream doesnt seem to work.

 

Heres the thing: i got a char defined somewhere in my code (without length, since i apparently cant set a var as length). Then im trying to read it with:

file.read((char*)&name, name_len)

With name_len being read right before that. But it seems like it"s somehow bypassing this after the 4th or 5th record, and wont go further in the file.

Therefore, when i use seekp to skip the number of chars set by name_len, the program keeps reading the file til the end.

 

Any idea about what im doing wrong here?

 

Thanks!