At the moment I have this code:
目前我有这个代码:
int main(int argc,char* argv[]) {
FILE * fp;
char * line = NULL;
size_t len = 0;
ssize_t read;
char * txtfile = argv[1];
fp = fopen(txtfile, "r");
if (fp == NULL)
exit(EXIT_FAILURE);
while ((read = getline(&line, &len, fp)) != -1) {
printf("Retrieved line of length %zu :\n", read);
printf("%s", line);
}
fclose(fp);
if (line)
free(line);
exit(EXIT_SUCCESS);
return 0;
}
i