程序代码:#include <stdio.h>
main()
{
FILE *fp = fopen("test.txt", "r");
if (fp == NULL)
{
return 0;
}
char s[256];
char *p1, *p2;
while (fgets(s, 256, fp) != NULL)
{
p1 = s;
while (*p1++ != ' ') NULL;
p2 = p1;
while (*p2++ != ' ') NULL;
*--p2 = '\0';
printf("%s\n", p1);
}
fclose(fp);
}