public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* problem with wifstream
@ 2002-10-03  8:31 de Chalendar Gael
  0 siblings, 0 replies; only message in thread
From: de Chalendar Gael @ 2002-10-03  8:31 UTC (permalink / raw)
  To: gcc-help

Hello,

I have a problem using wide characters file streams. There is really few
non-reference occurrences of this class name in the web and so I ask
here.

A "normal" version of the program works while the one using wide
characters does not work.
I don't know if is an error from me or a bug...

The files pasted below explain the problem. I showed the test file and
the two versions of the program with their results. I show also my
version of gcc.

Note that I am able to use the wstring and wstream classes when putting
wide characters strings directly inside the code. The problem appears
only with file reading.

Thanks in advance for your help.

______________
TEST txt file (a less of a windows1252 txt file)
ÞÇá ÇáÑÆíÓ ÇáÃãíÑßí ÌæÑÌ ÈæÔ Åä ÇáÈäÏ 214 ÇáãÊÚáÞ ÈÇáÞÏÓ Ýí ÞÇäæä
ÇáÚáÇÞÇÊ ÇáÎÇÑ
ÌíÉ ÇáÌÏíÏ ÇáÐí æÞÚå ÃãÓ "íÊÚÇÑÖ ÈØÑíÞÉ ÛíÑ ãÞÈæáÉ ãÚ ÓáØÇÊ ÇáÑÆíÓ
ÇáÏÓÊæÑíÉ ÈÔÃ
ä ÇáÓíÇÓÉ ÇáÎÇÑÌíÉ ááÃãÉ æÇáÅÔÑÇÝ Úáì ÇáÔÞ ÇáÊäÝíÐí"¡ æÃßÏ Ãä ÓíÇÓÉ
ÈáÇÏå ÈÔÃä Ç
áÞÏÓ áã ÊÊÛíÑ ÑÛã ÊæÞíÚå Úáì ÇáÞÇäæä ÇáãÔÇÑ Åáíå.

______________
TEST PROGRAM WITH ifstream
#include <iostream>
#include <fstream>

using namespace std;

int main(int argc, char *argv[])
{
	ifstream filefr;
	filefr.open("test.txt", ifstream::in );
	if (filefr) cout << "OK " << filefr.rdbuf() <<endl;
	else cerr << "ERROR" <<endl;
}

______________
RESULT with ifstream
OK ÞÇá ÇáÑÆíÓ ÇáÃãíÑßí ÌæÑÌ ÈæÔ Åä ÇáÈäÏ......

______________
TEST PROGRAM WITH wifstream
#include <iostream>
#include <fstream>

using namespace std;

int main(int argc, char *argv[])
{
	wifstream filefr;
	filefr.open("test.txt", wifstream::in );
	if (filefr) wcout << "OK " << filefr.rdbuf() <<endl;
	else wcerr << "ERROR" <<endl;
}

______________
RESULT with wifstream
OK 
[Nothing printed after that !!]

______________
MY GCC VERSION
gcc -v
Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.2/specs
Configured with: ../configure --prefix=/usr --libdir=/usr/lib
--with-slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info
--enable-shared --enable-threads=posix --disable-checking
--enable-long-long --enable-__cxa_atexit
--enable-languages=c,c++,ada,f77,objc,java
--host=i586-mandrake-linux-gnu --with-system-zlib
Thread model: posix
gcc version 3.2 (Mandrake Linux 9.0 3.2-1mdk)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-10-03 15:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-03  8:31 problem with wifstream de Chalendar Gael

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).