读取字符串出错 求大佬告知哪里错了
#include "stdafx.h"#include <string.h>
int main()
{
typedef struct
{
char TeamName[16];
char Group[2];
int GamesPlayed;
int GamesWon;
int GamesDrawn;
int GamesLost;
int GoalsFor;
int GoalAgainst;
int Points;
}team_t[32];
FILE *stream, *stream2; // variable name
char teamname[16];
char group[2];
errno_t err;
err = fopen_s(&stream, "C:\\Users\\User\\Desktop\\2018\\engg1003\\c3270010PI2\\c3270010PI2\\match.dat", "r"); //oprn the read file and check the file open or not
if (err == 0)
{
printf("The file myFile.dat was opened\n");
}
else
{
printf("The file myFile.dat wasn’t opened\n");
}
while (!feof(stream))
{
fscanf_s(stream, "%s %c ",teamname,16,group,2); //scan and print the value of n,s from read file
printf_s("%s %c \n",teamname );
}
return 0;
}
显示得不一样 求帮忙