| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 468 人关注过本帖
标题:高手帮看看这个程序
只看楼主 加入收藏
小旬_C
Rank: 2
等 级:论坛游民
帖 子:72
专家分:33
注 册:2010-7-25
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:5 
高手帮看看这个程序
#include "stdio.h"
#include "stdlib.h"
#define CNTL_Z '\032'
#define SLEN 50

int main(void)

{
     char file[SLEN];
     char ch;
     FILE *fp;
     long count,last;

     puts("enter the name of the file to be processed:");
     gets(file);
     if((fp = fopen (file,"rb"))==NULL)
     {
          printf("reverse can't open %s\n",file);
          exit(1);
     }

     fseek(fp,0L,SEEK_END);
     last=ftell(fp);
     for(count=1L,count<=last,count++)
     {
         fseek(fp,-count,SEEK_END);
         ch=getc(fp);
         if(ch!=CNTL_Z&&ch!='\r')
             putchar (ch);
         if(ch=='\r')
             putchar('\n');
         else
             putchar(ch);
     }
     putchar('\n');
     fclose(fp);
     return 0;


下面是错误信息,最近都是这个错误,求解中
Compiling...
frkd.c
C:\VC6\MyProjects\fseed\frkd.c(24) : error C2143: syntax error : missing ';' before ')'
C:\VC6\MyProjects\fseed\frkd.c(24) : error C2143: syntax error : missing ';' before ')'
执行 cl.exe 时出错.
2010-10-29 19:08
kacher
Rank: 2
等 级:论坛游民
帖 子:30
专家分:52
注 册:2009-9-26
收藏
得分:0 
留着回去看!
2010-10-29 19:12
NoSoul
Rank: 9Rank: 9Rank: 9
来 自:沈阳化工大学
等 级:蜘蛛侠
帖 子:283
专家分:1010
注 册:2009-6-6
收藏
得分:20 
首先你在return 0;后面丢了个}
 其次 你的for有问题 是;;你的是,,( for(count=1L,count<=last,count++))

我想伸手拉近點,竟觸不到那邊,就欠一點點,但這一點點...卻好遠
2010-10-29 19:12
chinesebear
Rank: 2
等 级:论坛游民
帖 子:23
专家分:29
注 册:2010-9-30
收藏
得分:0 
程序代码:
#include "stdio.h"
#include "stdlib.h"
#define CNTL_Z '\032'
#define SLEN 50

int main(void)

{
     char file[SLEN];
     char ch;
     FILE *fp;
     long count,last;

     puts("enter the name of the file to be processed:");
     gets(file);
     if((fp = fopen (file,"r+"))==NULL)
     {
          printf("reverse can't open %s\n",file);
          exit(1);
     }

     fseek(fp,0L,SEEK_END);
     last=ftell(fp);
     for(count=1L;count<=last;count++)
     {
         fseek(fp,-count,SEEK_END);
         ch=getc(fp);
         if(ch!=CNTL_Z&&ch!='\r')
             putchar (ch);
         if(ch=='\r')
             putchar('\n');
         else
             putchar(ch);
     }
     putchar('\n');
     fclose(fp);
     return 0;
}
没有质量的错误!
2010-10-29 22:15
小旬_C
Rank: 2
等 级:论坛游民
帖 子:72
专家分:33
注 册:2010-7-25
收藏
得分:0 
就是FOR循环的‘;’,嘿嘿,我一直都是用‘,’,现丑现丑

没有失败,只有暂时停止成功
2010-10-30 23:56
浩凡儿
Rank: 5Rank: 5
等 级:职业侠客
威 望:1
帖 子:101
专家分:394
注 册:2010-10-30
收藏
得分:0 
倒数十四行for语句格式错了应为for(语句1;语句;语句3)而不是,
2010-10-31 22:21
快速回复:高手帮看看这个程序
数据加载中...
 
   



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

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