gpt4 book ai didi

c++ - 类型 'const char*' 和 'const char [93]' 的二进制操作数无效

转载 作者:行者123 更新时间:2023-11-30 20:46:00 25 4
gpt4 key购买 nike

char b = (char)i;
char *text = "function make_page("+b+"){"
"var url = 'http://www.gigasena.com.br/loterias/mega-sena/resultados/resultado-mega-sena-'+"+b+"+'.htm';"
"var page = require('webpage').create();"
"var fs = require('fs');"
"page.open(url, function () {"
"page.evaluate(function(){"
""
"});"
"page.render('results/export-'+"+b+"+'.png');"
"fs.write('results/'+"+b+"+'.html', page.content, 'w');"
"phantom.exit();"
"});"
"}"
"make_page("+b+");";

最佳答案

您无法在 C++ 中添加字符串文字。如果您使用 std::string对象然后你可以这样做:

int i = 'a';
char b = (char)i;
std::string text = std::string("function make_page(") + b + "){"
"var url = 'http://www.gigasena.com.br/loterias/mega-sena/resultados/resultado-mega-sena-'+" + b + "+'.htm';"
"var page = require('webpage').create();"
"var fs = require('fs');"
"page.open(url, function () {"
"page.evaluate(function(){"
""
"});"
"page.render('results/export-'+" + b + "+'.png');"
"fs.write('results/'+" + b + "+'.html', page.content, 'w');"
"phantom.exit();"
"});"
"}"
"make_page(" + b + ");";

关于c++ - 类型 'const char*' 和 'const char [93]' 的二进制操作数无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30627073/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com