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语言实现宾馆管理系统课程设计 2023-03-13
- [C语言]二叉搜索树 2023-09-07
- C语言 详解字符串基础 2023-03-27
- [c语言-函数]不定量参数 2023-09-08
- 全面了解C语言 static 关键字 2023-03-26
- C语言编程C++旋转字符操作串示例详解 2022-11-20
- C++实现ETW进行进程变动监控详解 2023-05-15
- C++实战之二进制数据处理与封装 2023-05-29
- 带你深度走入C语言取整以及4种函数 2022-09-17
- centos 7 vscode cmake 编译c++工程 2023-09-17
