In ?? () () Cannot find bounds of current function问题
#include <stdio.h>#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#define List_size_max 10
#define Inflate_size 2
#define Len sizeof(Employee)
typedef struct
{
char name[20];
char num[10];
char sex[10];
int age;
char address[50];
double wage;
char healthy[50];
char education[50];
}Employee;
typedef struct
{
Employee*emply;
int list_max;
int list_len;
}List;
void creat(List *);
void inflate(List*,int);
void read(List *);
void save(List*);
char stri[100];
int main()
{
List employee;
creat(&employee);
read(&employee);
save(&employee);
return 0;
}
void creat(List*copy)
{
copy->emply=(Employee*)malloc(Len*List_size_max);
if(!copy->emply)
{
printf("出错\n");
exit(0);
}
copy->list_len=0;
copy->list_max=List_size_max;
}
void inflate(List*emp,int c_count)
{
emp->list_len=emp->list_max;
emp->list_max=(c_count/Inflate_size+1)*Inflate_size;
emp->emply=(Employee*)realloc(emp->emply,emp->list_max);
if(!emp->emply)
{
printf("出错\n");
exit(0);
}
}
void read(List*employee)
{
FILE*fp;
if((fp=fopen("employee.txt","r"))==NULL)
{
printf("Can not open the file,employee.txt\n");
exit(0);
}
char str[100];
fseek(fp,0,2);
int site=ftell(fp);
rewind(fp);
fgets(stri,100,fp);
int count=0;
int slen=0;
while(1)
{
while(site!=ftell(fp))
{
if(count<employee->list_max)
{
fscanf(fp,"%s %s %s %d %s %lf %s %s",employee->emply[count].name,\
employee->emply[count].num,employee->emply[count].sex,\
&employee->emply[count].age,employee->emply[count].address,\
&employee->emply[count].wage,employee->emply[count].healthy,\
employee->emply[count].education);
employee->list_len++;
}
else
{
if(count==employee->list_max)
{
fgetc(fp);
}
fgets(str,100,fp);
printf("%s",str);
slen+=strlen(str);
}
count++;
}
if(count<=employee->list_max)
{
break;
}
else
{
fseek(fp,-slen,2);
inflate(employee,count);
count=employee->list_len;
}
}
fclose(fp);
}
void save(List*emp)
{
FILE*fp;
if((fp=fopen("employ.txt","w"))==NULL)
{
printf("Can not open the file,employ.txt\n");
exit(0);
}
fputs("Name\t\tWage\n",fp);
int index=0;
for(;index<emp->list_len;index++)
{
fprintf(fp,"%s\t\t%.2f\n",emp->emply[index].name,emp->emply[index].wage);
}
fclose(fp);
}
源码如上,调试时出现In ?? () () Cannot find bounds of current function问题
调试时无法调试的地方是图中的圈出
[local]1[/local]
1442668796_626250.jpg
(39.87 KB)