How can I get the contents of a file at build time into my C++ string?(如何在构建时将文件的内容获取到我的 C++ 字符串中?)
问题描述
I have a file I am compiling in C++ in which I wish to have a string whose value is the contents of a file at the time of compilation.
In other words, I'd like to #include the file but have that be inside double quotes.
How can I do this in C++?
Now what if that file contains double quotes as part of its text, how do I get those escaped?
To correctly create a header with the correct null termination in the string use sed:
xxd -i ${INPUT_FILE_NAME} | sed s
本文标题为:如何在构建时将文件的内容获取到我的 C++ 字符串中?


- 详解C语言中sizeof如何在自定义函数中正常工作 2023-04-09
- C语言qsort()函数的使用方法详解 2023-04-26
- Easyx实现扫雷游戏 2023-02-06
- c++ const 成员函数,返回一个 const 指针.但是返回的指针是什么类型的 const? 2022-10-11
- ubuntu下C/C++获取剩余内存 2023-09-18
- C语言详解float类型在内存中的存储方式 2023-03-27
- 我应该为我的项目使用相对包含路径,还是将包含目录放在包含路径上? 2022-10-30
- Qt计时器使用方法详解 2023-05-30
- C语言手把手带你掌握带头双向循环链表 2023-04-03
- C++ 数据结构超详细讲解顺序表 2023-03-25