标题:求助高手think in c++ 中程序的问题
取消只看楼主
lzj722
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2009-4-20
 问题点数:0 回复次数:0 
求助高手think in c++ 中程序的问题
#include <stdlib.h>
#include <assert.h>
#include "Nest.h"
#include <stdio.h>
#include <string.h>

void main(int argc,char** argv)
{
    stack textlines;
    FILE* file;
    char* s;
    #define BUFSIZE 100   
    char buf[BUFSIZE];
    assert(argc==2);
    textlines.initialize();
    file=fopen(argv[1],"r");
    assert(file);
    while(fgets(buf,BUFSIZE,file))
    {
        char* string=(char*)malloc(strlen(buf)+1);
        assert(string);
        strcpy(string,buf);
        textlines.push(string);
    }

    while((s=(char*)textlines.pop())!=0)
    {
        printf("%s",s);free(s);
    }
    textlines.cleanup();
}

运行后出现fatal error  ,说    assert(argc==2);有错误
搜索更多相关主题的帖子: think 
2010-05-08 20:44



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-305879-1-1.html




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

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