如何在ubuntu中的c++中设置html
How to setup html within c++ in ubuntu?
我想用C++设计一个网页。在ubuntu PC中,从C++文件设计它所需要的所有软件包是什么?
我还想知道如何将c++文件的输出重定向到web浏览器。
我只想从C++文件输出一些HTML,不想写任何web服务器。
假设您指的是C++ executable
,那么只需将其输出到一个文件(扩展名为.html)就可以实现这一点。
大致如下:
#include <iostream>
#include <fstream>
int main() {
std::ofstream htmlfile;
htmlfile.open ("index.html");
htmlfile << "<!DOCTYPE html>";
htmlfile << "<html>";
htmlfile << "<head>";
htmlfile << "<meta charset="UTF-8">";
htmlfile << "<title>Title of the document</title>";
htmlfile << "</head>";
htmlfile << "<body>";
htmlfile << "Content of the document.";
htmlfile << "</body>";
htmlfile << "</html>";
htmlfile.close();
}
相关文章:
- 为不同配置设置MSVC_RUNTIME_LIBRARY的正确方法是什么
- 在C++/Linux中设置单调时钟的一些技巧
- 如何在选项卡视图Qt中设置一个新项目,并保存以前的项目
- 嵌套在类中时无法设置成员数据
- 需要帮助设置在C++中使用的Potrace
- 如何在自删除后将对象设置为nullptr
- 将指针设置为"nullptr"并不能防止双重删除?
- 如何在Ubuntu中使用cmake设置qt4
- ld:bind_at_load和-bitcode_bundle(Xcode设置ENABLE_bitcode=YES)不能
- 如何在boost beast http请求中设置http头
- 如何解决gcc编译器优化导致的centos双编译器设置中的分段错误
- 如何将这个C++哈希表转换为动态扩展和收缩,而不是使用硬设置的最大值
- 为什么文件名被设置为一个点,而不是在读取矢量中的文件名时
- 如何在24位SDL_Surface上设置像素的颜色
- 如何在卷曲中将邮件正文设置为 html
- C++-CString不确定为转储html源设置什么值
- 如何在ubuntu中的c++中设置html
- QWebView 无法显示通过 javascript 设置的外部图像内容 $( "#<node_name>" ).html(<html_content>)
- 如何在VC++中将HTML Unicode文本设置为剪贴板
- 如何将包含空格的字符串设置为HTML文本字段(在表单中)的默认值