以下代码在 Dev C++ 中运行良好,但是当我在 turbo CI 中运行时没有得到任何输出。我已经将数据存储在 users.bin 文件中。
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
#define MAX_LIMIT 50
struct User {
char userName[20];
char password[20];
float accountBalance;
short int failedAttempts;
char status; //---------- l for locked account and u for non-locked account
}user[MAX_LIMIT];
FILE* fp;
void main()
{
short int userCode;
char uName[10];
//will read the available user information from users.bin file
fp=fopen("users.bin","rb");
fread(user,sizeof(struct User),MAX_LIMIT,fp);
printf("%s",user[1].userName);
}