LMlib.h
#ifndef LMlib_H
#define LMlib_H
#endif
#define MAX_IP_LENGTH 15
#define MAX_TABLE_ROWS 255
struct ForwardingTableRow
{
char address[MAX_IP_LENGTH];
int subnetMask;
int interface;
};
typedef struct ForwardingTableRow ForwardingTableRow;
LMlib.c
#include <stdio.h>
#include <math.h>
#include "LMlib.h"
void ReadForwardingTable(FILE* f,ForwardingTableRow * table)
{
int i;
for(i=0;i<MAX_TABLE_ROWS;i++)
{
fscanf(f,"%s %d %d",&table.address[i],&table.subnetMask[i],&table.interface[i]);
}
}
编译器命令:
cc LMlib.c LMlib.h main.c -lm
错误:
LMlib.c: In function ‘ReadForwardingTable’:
LMlib.c:11:27: error: request for member ‘address’ in something not a structure or union
LMlib.c:11:45: error: request for member ‘subnetMask’ in something not a structure or union
LMlib.c:11:66: error: request for member ‘interface’ in something not a structure or union
我做错了什么?