System call
Inviato: ven 16 mar 2007, 21:15
Ho il seguente problema:
Sono i miei primi passi nella programmazzione linux in C!però non capisco perchè quelle costanti non le riconosce..manca qualche libreria per caso??ecco il sorgente nella sua parte iniziale:ciro@w7j:~/Desktop$ gcc -o esercizio.out Exercise-1.c
Exercise-1.c: In function 'main':
Exercise-1.c:20: error: 'S_IRUSR' undeclared (first use in this function)
Exercise-1.c:20: error: (Each undeclared identifier is reported only once
Exercise-1.c:20: error: for each function it appears in.)
Exercise-1.c:20: error: 'S_IWUSR' undeclared (first use in this function)
Exercise-1.c:20: error: 'S_IRGRP' undeclared (first use in this function)
Exercise-1.c:20: error: 'S_IROTH' undeclared (first use in this function)
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#define FILE_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)
int main(void)
{
int fd, i, j;
off_t offset_store;
off_t offset;
char *buff, c;
char string_num[10] = "1234567890";
char string_Let[10] = "abcdefghil";
buff = calloc(25, sizeof(char));
if((fd = open("FILE1", (O_RDWR | O_APPEND | O_CREAT | O_TRUNC),FILE_MODE)) <0)
printf("\n an error occurred opening the file\n");