[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cobalt-developers] Help: error when reading a file with C++



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;
    for (;read(fd, buf, 1);)
        cout << *buf;
}
 
 
The program return a lot of « Z » and read not the file only on a
cobalt.
 
Thanks for your response
 
 
Pascal.