|
![]() |
#1 |
Banned
Datum registracije: Sep 2004
Lokacija: ST
Postovi: 95
|
C u Unixu
program čita sadržaj datoteke i ispisuje ga. Ime datoteke se zadaje kao argument naredenog retka. #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main(int argc, char *argv[]) { int fd1, n; char sl; if (argc < 2) { printf("Koristenje: vjezba4 <ime_datoteke>\n"); exit(0); } fd1=open(argv[1], O_RDONLY); if (fd1 < 0) { perror("open"); exit(-1); } while((n=read(fd1, &sl, 1)) > 0) { write(STDOUT_FILENO, &sl, 1); } if (n == -1) { perror("read"); } close(fd1); exit(0); } Evo ako ima ko da mi malo bolje i detaljnije objasni navedeni program jer treba mi za vježbe Hvala! |
![]() |
![]() |
|
|
Oglas
|
Oglasni prostor
|
![]() |
|
|