【发布时间】:2012-11-28 01:00:44
【问题描述】:
我又回来了一个我似乎无法克服的段错误。
我已经弄清楚它到底是什么,它与 char* 字符串行有关。我用它来分解字节以获取此 pdf 文件以用于学校作业。
感谢您的任何帮助!
void* consumer(void *temp)
{
int* stuff = reinterpret_cast<int*>(temp);
int x = *stuff;
char* string[];
stringstream stream1;
stringstream stream2;
int temp1=0;
int temp2=0;
int sent1=0;
int sent2=0;
ofstream fout;
strcpy(string,request); //SEGFAULT(11) ON THIS LINE, WHEN CALLING "string"
strcat(string,"Byte Range: ");
...
完整的代码可以在这里找到; https://www.dropbox.com/sh/dt90ot3z4v5nruy/1H9a5Cyb5A mgetweb.h 和 mgetweb.cpp
【问题讨论】:
标签: c++ pthreads segmentation-fault producer-consumer