所以我有以下结构:
struct dados{
int triage;
int doctors;
int shift;
int mq_max;
}data;
我正在尝试阅读由以下内容组成的文件config.txt:
TRIAGE = 5DOCTORS = 10SHIFT_LENGTH = 5MQ_MAX = 20
以下列方式:
int main{
FILE *fp = fopen("config.txt","r");
fscanf(fp,"TRIAGE=%dDOCTORS=%dSHIFT_LENGTH=%dMQ_MAX=%d",&data.triage,&data.doctors,&data.shift,&data.mq_max);
return 0;
}
但它只是打印内存地址,显然我需要=
旁边的值。