Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- // Hartmeyer Vincent
- int main (int argc, char *argv[])
- {
- if (argc!=2)
- {
- printf("Argument requis : taille du buffer");
- exit(1);
- }
- int taille=atoi(argv[1]);
- int c;
- /*allocation du buffer*/
- unsigned char* buffer= (unsigned char*)malloc(taille*sizeof(unsigned char));
- c=read(0,buffer,taille);
- while(c!=0)
- {
- write(1,buffer,c);
- c=read(0,buffer,taille);
- }
- /*on désalloue*/
- free(buffer);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement