2 open opentmpmyfile txt ORDONLY opentmpmyfile txt ORDONLY Slides: 77 Download presentation Το 2ο όρισμα της συνάρτησης open - Παραδείγματα open("/tmp/myfile. txt", O_RDONLY); open("/tmp/myfile. txt", O_RDONLY, S_IRWXU); open("thefile. bin", O_WRONLY | O_TRUNC); open("thefile. bin", O_WRONLY | O_CREAT, S_IRWXU | S_IRGRP); open("thefile. bin", O_WRONLY | O_CREAT | O_EXCL, S_IRWXU); open("thefile. bin", O_RDWR | O_SYNC); open("thefile. bin", O_RDWR | O_APPEND); Παράδειγμα [long_name. c] #define MAX_NAME_GUESS 256 int make_long_filename(char *path) { char *the. File. Name; int fd, the. Size, ctr, path. Len = strlen(path); if ((the. Size = pathconf(path, _PC_NAME_MAX)) == -1) { if (errno == 0) the. Size = MAX_NAME_GUESS; else { perror("_PC_NAME_MAX: "); exit(1); } } if ((the. File. Name = malloc(the. Size + path. Len + 4)) == NULL) { perror("malloc"); exit(1); } strcpy(the. File. Name, path); the. File. Name[path. Len] = '/'; for (ctr = 1; ctr <= the. Size + 1; ctr++) the. File. Name[path. Len + ctr] = 'a'; the. File. Name[path. Len + ctr] = '