[Dev-C++] O_WRONLY, O_RDONLY unrecognized
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <vil...@ya...> - 2001-04-23 10:15:14
|
Does anybody know why the compiler doesn't recognize O_WRONLY, O_RDONLY, ...
in function "open"?
I get the error "12 c:\prova.c `O_WRONLY' undeclared (first use in this
function)",
but I think it sould work if including unistd.h and fcntl.h, isn't it?
-----------------------------
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
char buffer[1024] ;
int fd,i,j,k ;
memset(&buffer,'a',1024) ;
fd = open("./prova",O_WRONLY) ;
for (i=1; i<=2;i++)
{
printf("El valor de %d\n",i) ;
for (j=1; j<=5;j++)
write(fd,buffer,1024) ;
}
close(fd) ;
system("PAUSE");
return 0;
}
_______________________________________________________________
Do You Yahoo!?
Envía mensajes instantáneos y recibe alertas de correo con
Yahoo! Messenger - http://messenger.yahoo.es
|