int main(int argc, char *argv[]) { shmid = shmget(SHMKEY, sizeof(syncvars), PERMS | IPC_CREAT); /* function prototype for file access */ void fileaccess(int fd, int count); int fd, count; /* Check for command line arguments */ if (argc != 2) { printf("Usage: sync1 count\n"); return; } count = atoi(argv[1]); /* Use UNIX input/output system calls for accessing the file */ fd = open("datafile", O_RDWR, 0); fileaccess(fd, count); return 0; }
int main(void) { char source[200]; char destiny[200]; /* Dateinamen einlesen */ printf("Bitte die Quelldatei angeben: "); scanf(" %s", source); printf("Bitte die Zieldatei angeben: "); scanf(" %s", destiny); /* Verarbeitungsvorgang starten */ fileaccess(source,destiny); }
int main(int argc, char *argv[]) { int fd, count; if(argc != 3){ printf("usage: process1 filename count\n"); return -1; } count = atoi(argv[2]); fd = open(argv[1], O_RDWR, 0); fileaccess(fd, count); return 0; }
int main(int argc, char *argv[]) { /* function prototype for file access */ void fileaccess(int fd, int count); int fd, count; /* Check for command line arguments */ if (argc != 2) { printf("Usage: nosync0 count\n"); return; } count = atoi(argv[1]); /* Use UNIX input/output system calls for accessing the file */ fd = open("datafile", O_RDWR, 0); fileaccess(fd, count); return 0; }