| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 802 人关注过本帖
标题:In ?? () () Cannot find bounds of current function问题
只看楼主 加入收藏
天际b
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2014-11-19
结帖率:50%
收藏
已结贴  问题点数:20 回复次数:4 
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)
图片附件: 游客没有浏览图片的权限,请 登录注册
搜索更多相关主题的帖子: education function current address include 
2015-09-20 17:04
诸葛欧阳
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:流年
等 级:贵宾
威 望:82
帖 子:2790
专家分:14619
注 册:2014-10-16
收藏
得分:7 
你这几个函数该返回的没返回,操作的不是同一个链表吧

一片落叶掉进了回忆的流年。
2015-09-20 17:38
天际b
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2014-11-19
收藏
得分:0 
我没有用链表,定义的函数不要返回值
2015-09-20 22:29
小王KING
Rank: 2
等 级:论坛游民
威 望:1
帖 子:29
专家分:69
注 册:2015-9-9
收藏
得分:7 
我把所有的变量定义都调正到函数最前面,编译通过,(我的是TC)
2015-09-20 23:07
天际b
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2014-11-19
收藏
得分:0 
我用的是codeblocks
没法调试
2015-09-21 09:59
快速回复:In ?? () () Cannot find bounds of current function问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.029218 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved