10

一个segmentation fault 问题

int main()
{

//srand(time_t(NULL));
time_t t;
srand((unsigned) time(&t));
char filename[100] = "hep.txt";
bool directed = false;
int R = 100;

Graph::BuildFromFile2WC(filename);
.....
}

//下面是调用的原函数
void Graph::BuildFromFile2WC(char *file){

if (built)
    return;
built = true;

FILE* in = fopen(file, "r");
fscanf(in,"%ld %ld", &n, &m);

....}

执行到Graph::BuildFromFile2WC(filename);时就显示 segmentation fault,怎么解决啊,求大神指点

查看全部
jj314145738
小结0914
2017/09/04 18:17
  • c++
  • segmentation
  • 点赞
  • 收藏
  • 回答
    私信

5个回复