C++从 PHP 获取变量
C++ get variable from PHP?
我创建了一个Web界面,允许用户选择一个txt文件。我的C++程序会去文件夹,根据用户选择的txt文件执行(基本上文本文件内容是关于配置的,所以程序需要根据用户在网页上的选择来加载配置(。现在的问题是,如何将文本文件名传递给cpp程序。我用粗体和斜体附加的编码是行不通的,只是我想存档的意图。
int main(***string filename***)
{
using namespace std;
vector<string> strings;
string path = "/home/pi/Desktop/DMixer_Webinterface_Downloadfile/";
string fullpath = path + ***filename***;
// ifstream file("/home/pi/Desktop/DMixer_Webinterface_Downloadfile/abc_2017_03_10_23_24_52.txt");
ifstream file(fullpath);
std::string str;
while (std::getline(file, str, ','))
{
myArray[array_count] = str; // store those value in array
// cout << str << "n";
strings.push_back(str);
array_count++;
}
x_gap_value = atof(myArray[2].c_str());
y_gap_value = atof(myArray[3].c_str());
return 0;
}
只需将
string param
在你的主方法中,用一个带有参数的参数调用你的程序。
啧:
http://www.cplusplus.com/articles/DEN36Up4/
相关文章:
- 尝试通过OCI例程从Oracle获取blob数据,但出现错误:ORA-01008:并非所有变量都绑定
- 使用递归时获取变量的奇怪值
- 从 C 中的变量获取文件的路径,C++
- 我可以从其变量中获取对类对象的引用吗?
- 为什么在分配给成员变量之前获取unique_ptr的返回是一个问题?
- std::cin 从控制台获取两种不同的变量类型,'storing'以后使用第二种类型?
- 如何使用可变参数模板获取参数的变量号及其大小C++
- 获取具有静态局部变量的绑定/推断捕获 lambda 的函数指针
- constexpr 函数在编译时获取值,即使我的变量不是 constexpr
- 如何在不为其声明变量的情况下获取和使用常量值的地址?
- 附加调试器并以编程方式获取变量地址 Visual Studio
- 是否可以将变体的索引作为 constexpr 变量获取?
- 为什么我无法获取 MSVS2019 / C++ 中字符或uint8_t变量的内存地址?
- 我正在尝试获取类私有成员中变量的输入
- C++/Win32 构造函数不使用从对话框获取的字符串初始化变量
- 使用基地址和偏移量获取变量的地址
- C++11 - 获取编译时的所有类变量,并在没有 Boost 的情况下为它们调用方法
- 使用 WindowSetup 类变量获取错误
- fstream 变量获取文本文件中的所有行
- 从类型而不是从变量获取指针级别