On Tue, 24 Sep 2002 09:23:35 +0200
"Pascal Genest" <[EMAIL PROTECTED]> wrote:
> Hello�!
> �
> I use this code�:
> �
> #include <iostream>
> #include <unistd.h>
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <fcntl.h>
> void main ()
> {
> int fd = open("essai.txt", O_RDWR);
> char * buf;
buf is a pointer to char, but where does it point? Depends on what is on the stack.
> for (;read(fd, buf, 1);)
> cout << *buf;
So here we are reading one char into where buf points, and printing it, but buf could
be pointing anywhere!
> }
> �
> �
> The program return a lot of ��Z�� and read not the file only on a
> cobalt.
> �
> Thanks for your response
> �
> �
> Pascal.
>
>
>
> _______________________________________________
> cobalt-developers mailing list
> [EMAIL PROTECTED]
> http://list.cobalt.com/mailman/listinfo/cobalt-developers
>
--
Dale P. Smith
Senior Systems Consultant, | Treasurer,
Altus Technologies Corporation | Cleveland Linux Users Group
[EMAIL PROTECTED] | http://cleveland.lug.net
440-746-9000 x339 |
_______________________________________________
cobalt-developers mailing list
[EMAIL PROTECTED]
http://list.cobalt.com/mailman/listinfo/cobalt-developers