#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char** argv)
{
FILE *fp = fopen(argv[1], "r");
if(NULL == fp)
{
perror("error open\n");
return -1;
}
int len = 0;
char* line = NULL;
int n = 0;
while((getline(&line, &n, fp)) != -1)
{
printf("%s", line);
len += strlen(line);
}
printf("%d\n",len);
if(line)
{
free(line);
line = NULL;
}
fclose(fp);
return 0;
}