声明:我不知道我在做什么&试图谷歌我的方式通过这个;无效使用非静态成员函数(while循环/无类/ wget popen)
编译错误;
main.cpp: In function ‘int sourcePull()’:
main.cpp:35:28: error: invalid use of non-static member function
system(command.c_str + source);
^
Source Function;
#include <cstdio>
#include <stdio.h>
#include <fstream>
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
int sourcePull()
{
string source;
string command;
command = "wget -np -a source.log ";
ifstream sourceFile ("sources.txt");
if (sourceFile.is_open())
{
while (sourceFile.good())
{
while (sourceFile >> source)
{
//system(command.c_str + source);
FILE* file = popen(command.c_str + source, "r");
}
sourceFile.close();
}
}
return 0;
}
不知道如果“源”是一个成员函数,当我没有它的成员类时它将是一个成员函数。
曾试图使“源”的指针(*源),参考源(&源),没有骰子...
感谢提前任何帮助。
c_str - > c_str() –