用vc++6.0运行读取txt文件
pfPlane = fopen("plane.txt", "ab+");
if (pfPlane == NULL)
{
printf("can't open plane.txt!");
return 0;
}
while (!feof(pfPlane))
{
pstPlaneNodeTemp = (struct PlaneNode*)malloc(sizeof(struct PlaneNode));
if (fread(pstPlaneNodeTemp, sizeof(struct PlaneNode), 1, pfPlane) == 1)
{
pstPlaneNodeTemp->pstNext = NULL;
pstPlaneNodeCur->pstNext = pstPlaneNodeTemp;
pstPlaneNodeCur = pstPlaneNodeTemp;
}
}
free(pstPlaneNodeTemp);
fclose(pfPlane)
txt文件:
1101 | 西安 | 兰州 | 8:00 | 10:00 | 500 | 7.5 | 50
1201 | 西安 | 上海 | 7:00 | 10:00 | 900 | 8 | 50
1205 | 西安 | 郑州 | 9:00 | 10:00 | 300 | 9 | 50
1374 | 西安 | 成都 | 11:00 | 13:30 | 600 | 8 | 50
2660 | 西安 | 拉萨 | 9:00 | 13:30 | 1000 | 7 | 50
怎么可以变正常