#define _CRT_SECURE_NO_DEPRECATE
#include <stdio.h>
#include <string.h>
#include <windows.h>
#include <stdlib.h>
typedef struct{
int FlightID;
char Destination[10];
char date[11];
char time[5];
int seatNo;
}flightInfo;
int flightChecking(flightInfo *FlightRec[]);
int main()
{
int flightid;
flightInfo flightRec[2];
flightid= flightChecking(&flightRec);
return 0;
}
int flightChecking(flightInfo *FlightRec[])
{
int i;
FILE *getFlight;
getFlight = fopen("Flight.txt", "r");
for(i=0;i<2;i++){
while((fscanf(getFlight, "%d ", &(*FlightRec[i]).FlightID))!=EOF)
{
fscanf(getFlight, "%d ", &(*FlightRec[i]).FlightID);
fscanf(getFlight, "%s ", (*FlightRec[i]).Destination);
fscanf(getFlight, "%s ", (*FlightRec[i]).date);
fscanf(getFlight, "%s", (*FlightRec[i]).time);
fscanf(getFlight, "%d", &(*FlightRec[i]).seatNo);
break;
}
}
return 0;
}
However, i get the following warning messages:
warning C4047: 'function' : 'flightInfo **' differs in levels of indirection from 'flightInfo (*)[2]'
warning C4024: 'flightChecking' : different types for formal and actual parameter 1.
I cant get the user defined function to accept a structure array =( Can anyone help me please?
You help is greatly appreciated.
Thanks in advance
This post has been edited by shangyi: 04 December 2008 - 02:28 AM

New Topic/Question
Reply



MultiQuote



|