Re: [Dev-C++] O_WRONLY, O_RDONLY unrecognized
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <jos...@ya...> - 2001-04-24 06:45:36
|
I pasted the copy and when compiling the only errors I got were due to
the absence of these lines at the top of the file.
#include <stdlib.h> //for system("PAUSE")
#include <string.h> //for memset(...)
After I added them the program compiled and run as expected.
Hope this helps.
Chemanuel
--- Albert Vilella Bertran <vil...@ya...> escribió: > 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
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
_______________________________________________________________
Do You Yahoo!?
Envía mensajes instantáneos y recibe alertas de correo con
Yahoo! Messenger - http://messenger.yahoo.es
|