iva*_*rne 0 c c++ string documentation
我有一个小型库,其中包含一些应该在运行时可用的文档,但MS Visual Studio C++编译器只允许长度高达2,048字节的字符串文字,这种限制是否存在一种简单的方法?我能找到的唯一解决方案是创建一个字符串数组,然后分配一个新缓冲区并将字符串复制到.
char *doc_arr[] = {
"Documentation for my program\n",
"\n",
"This is a seccond line\n",
// and so on ....
}
int doc_arr_length = 203; // number lines in doc_arr
char doc[3502]; // number of bytes in dockumentation
strcpy(doc, doc_arr[0]);
for(int i = 1; i < doc_arr_length; i++){
strcat(doc, doc_arr[i]);
}
Run Code Online (Sandbox Code Playgroud)
更新:看起来需要一些上下文.
我有一个ruby程序,它需要很多选项并收集大量数据并生成.c文件..c文件被编译为.dll,然后在其他程序中用于快速计算.这意味着您很快就会获得许多不同的.c和.dll,并且很难管理版本.我认为在包含源文件和编译dll中的ruby脚本的选项中包含合成文档可能是个好主意.