一切正常
FILE *outfile = fopen(resultPath.c_str(), "w");
curl_easy_setopt(curl, CURLOPT_WRITEDATA, outfile);
但我不想使用 fopen(),因为我在其余代码中使用了 ofstream。 所以我尝试了这个:
ofstream outfile;
outfile.open(resultPath.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEDATA, outfile.beg);
不知道第三个参数是否正确,编译的时候没有报错,但是写的时候程序崩溃了。 那么执行此操作的正确方法是什么?
最佳答案
That parameter can be a long, a function pointer, an object pointer or a curl_off_t, depending on what the specific option expects.
关于c++ - 使用 ofstream 时,我应该将什么作为 curl_easy_setopt 中的第三个参数传递?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17993939/