+ 3
Read wstring using File pointer
Hi I have used _wfopen in a+ mode. I am able to use fwscanf to read content of file but it gets terminated when there is white space. Is there a way to read full line till new line character is occured ? Also need to know where file pointer is reached by reading a single line. Many thanks in advance..
5 Respuestas
+ 3
Ketan Lalcheta I have minimal experience with wide strings in file handling, so I am shooting in the dark now. It might work without the "ls", so try "%[^\n]" exactly.
BTW, it is recommended to use fgetws() instead of fwscanf().
+ 3
Have you tried the format "%[^\n]"?
The C function ftell() can report the current byte offset in the file stream.
+ 3
Ipang i have not attach it here as this is piece of code from main project
Also does file reading work on sololearn? If yes, I can share code here.
+ 2
Brian it is wide string so I had %ls.... I changed to %[^\n]ls
And
%s[^\r\n]ls
None of them worked... Am I missing something ?
+ 1
Thanks Brian ...I have chosen fgetws().