Skip to content

Instantly share code, notes, and snippets.

@vfrico
Last active March 27, 2016 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vfrico/235722951d57962fe091 to your computer and use it in GitHub Desktop.
Save vfrico/235722951d57962fe091 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#define MAXIMO 15
int main(){
int t, total;
char text[MAXIMO];
total = 0;
printf("Introduce un texto: \n");
while((t = read(0, &text, MAXIMO)) > 1){
total = total + t;
write(1,&text,t);
}
printf("Tamaño: %d\n", total);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment