I'm attempting to write a program in c to modify,write and create to files on a Sun 8.X. I having problems compiling when I attempt to use the write and lseek commands. Should I use a function and then do a function call to manipulate the commands because currently I have them it in main..ex below:
#include </usr/include/fcntl.h>
#include </usr/include/stdio.h>
.
.
.
main()
{
int fd;
fd = open("/file", O_RDWR);
While ( read(fd) == len)
{
lseek(fd, 10, SEEK_SET);
write(fd, "hello", 5);
break;
}
close(fd);
}
But the compile error give me this:
implicit declaration of function 'int lseek(...)'
implicit decalaration of function 'int write(...)
implicit declaration of function 'int close(...)
#include </usr/include/fcntl.h>
#include </usr/include/stdio.h>
.
.
.
main()
{
int fd;
fd = open("/file", O_RDWR);
While ( read(fd) == len)
{
lseek(fd, 10, SEEK_SET);
write(fd, "hello", 5);
break;
}
close(fd);
}
But the compile error give me this:
implicit declaration of function 'int lseek(...)'
implicit decalaration of function 'int write(...)
implicit declaration of function 'int close(...)