Re: unsigned statt signed chars aus Datei lesen

Michael Wenger <[email protected]>
Newsgroups gmane.linux.suse.programming
Message-ID <[email protected]>
Hi Christian!

Christian Schneider schrieb am 08.05.2005 02:02 :
> Hier sollte statt "char" "unsigned char" verwendet werden:
> 
>   char ch[3];
>   ifstream file(argv[1]);
>   file.read(ch, 3);
> 
> Wie geht das?

Etwa so (ungetestet):
    unsigned char ch[3];
    ifstream file(argv[1]);
    file.read(reinterpret_cast<char*>(ch), 3);

Gruß,
Michael
signature.asc (application/pgp-signature, 546 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iQEVAwUBQn1llnGeOfdBLQhTAQKWDAf8CyLmUW9AFX+j3PiTG1FDmFfsSKNEMBR6
Jqi+V1RLUGQsofBqfoTrO8t8sVE/oAX3h3/82BjNopep68+YVb8uFXLD/eQ3XPoj
K48OPJVxGBsrCj5iOF5u3EdlQ3XizYpMxLp9pnaDbTFXvIqiRshtOauAgPaVGo15
AQhvU43rEhri837x6MOOxGnSub5h2HJXHFO4XlPHuttIJcGtnp33yhcERPVs9nm7
cseG6VsyFkne0WGBKWWl5776HzEtgQhY0WKdKoeG7xI1yZWCR1rW1o9lNUaaNjAX
v4/Lu9d+J3FURLl2xcJJ4buGCc7kdlApC8WFTRGEtWInivnD+vdE4A==
=cch1
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.