次のコードは Dev C++ では正常に動作しますが、ターボ 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);
}