Hello, I'm using PellesC 6.0 and want to compile some codes with many traditional unix-style c functions. I can see the .h files in the dir 'include', such as io.h / fcntl.h ... but when I build the project, the ide always show me warnings and errors regarding 'missing prototype for those functions' or 'undeclared identifier'. Here is the simple test code:
#include <io.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
char *filename="mytext.txt";
char *text="Hello, world!\n";
int main()
{
int i;
i=open(filename,O_CREAT|O_RDWR);
if(i==-1){
printf("error to open the file!\n");
return -1;
}
if(write(i,text,strlen(text))==-1){
printf("fail to write!\n");
close(i);
return -1;
}
else{
printf("success to write!\n");
close(i);
return 0;
}
}
The original definitions for many old times functions (as open and its flags) are considered deprecated and renamed prepending an underscore. Anyway you can force compiler to define them in original form (without underscore) by using the switch "-Go" on the compiler command line, or checking it on the project compiler tab if you use the IDE.
So you have two options set oldnames by switch, or prepend an undescore to them.
thanks a lot! It works. :)