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语言 structural body结构体详解用法 2022-12-06
- C/C++编程中const的使用详解 2023-03-26
- 如何C++使用模板特化功能 2023-03-05
- 详解c# Emit技术 2023-03-25
- C++详细实现完整图书管理功能 2023-04-04
- C++中的atoi 函数简介 2023-01-05
- 一文带你了解C++中的字符替换方法 2023-07-20
- C++使用easyX库实现三星环绕效果流程详解 2023-06-26
- C利用语言实现数据结构之队列 2022-11-22
- C语言基础全局变量与局部变量教程详解 2022-12-31