FLTK和串联char的问题
Issues with FLTK and concatenated char
i在FLTK应用程序(C )上工作,我必须创建在FL_Browser中设置的名称。基本上,此结构以
获得" const char*"浏览器 -> add("我的字符串..");
但是...我需要每个字符串接收正确的名称:" process"加上IT号,例如:" process 1"," Process 2",...
整个字符串必须是const char*,数字是由计数器接收的,该数字增加了一定的命令;
我需要这样的东西:
int count=1;
while (count < 100) {
const char* name;
name = "Process" + count;
count++;
}
我如何限制这两个变量?
您应该使用字符串流,例如:
while (count < 100) {
std::ostringstream name;
name << "Process" << count;
browser->add(name.str().c_str());
count++;
}
相关文章:
- 构造函数 (C++) 中的 char 指针参数存在问题
- 没有'str'成员在 GCC 和 Clang 'std::basic_ostream<char>',但 MSVC 没有问题
- 通过指针使用C++还原char数组时出现问题
- "char(a)" C++的问题
- 愚蠢的问题:strcat和char指针
- 语法问题:"char [5] const &"是什么意思?
- 如何将char数组声明为函数参数?或告诉我此代码中还有其他问题?
- Char 数组的问题,如何正确构造和显示它们
- 使用C ,将转换为char的问题始终具有3位数字
- 将 char* 推送到矢量时出现问题,但在每次迭代后,它会将指向相同值缓冲区的指针添加到矢量中
- char,const char*阵列问题,用于mqtt client.publish
- 以C++语言打印 CHAR 数组时出现问题
- 将 API 函数参数从 'char *' 更改为"const char *"有哪些潜在问题?
- 接受类型char的输入的问题
- 有人能解释一下getline和char的问题吗
- Windows 10中的Char*的内存分配问题
- 将 char * 与字符串文本进行比较时出现问题
- 将wchar_t*转换为char*时出现问题
- FLTK和串联char的问题
- ifstream 对象的 .read() 问题 *char