如何在 C++ 中将彩色内容打印到 CSV 文件中
how to print colored contents into csv file in c++
我正在尝试将颜色值打印到输出文档或某些支持颜色的文件中,我发现将彩色值打印到控制台中,但它没有应用文件输出值,我尝试了几个头文件rang.hpp和rlutil.h,但两者都很有用,但仅用于在控制台中打印而不是用于输出文件。 这是我的尝试代码
#include<iostream>
#include<fstream>
using namespace std;
void PrintColoredFile(ofstream& outfile)
{
outfile<<"red,blue"<<endl; //I don't know how to print coloured values
outfile<<"This is a red colored message, This is a blue colored message"<<endl;
}
int main()
{
ofstream outFile.open("My_ColouredFile.doc",ios::out);
if(!outFile)
exit(1);
PrintColoredFile(outFile);
return 0;
}
这不是一个重复的问题,我到处尝试,但没有找到解决这个问题的方法。请帮助我,
CSV 代表逗号分隔的值。不能在 csv 文件中存储任何颜色值。它是纯文本。
通常Microsoft Excel是打开csv文件的标准工具。如果您将某些文本设置为彩色并想要保存该 csv 文件,Excel 会告诉您一些其他信息无法存储并且会丢失。
相关文章:
- 回溯C++不打印函数,因此文件
- 在gem5中打印文件中的所有cache_blocks
- 打印逐行存储的文本文件
- 读取文件中所有可能的十六进制 16 字节序列并打印每个序列
- C/C++:打印(配置)头文件的内容
- 如何使代码打印文本文件中的第一行?
- 如何将文本文件读取到二维数组中并以 c++ 打印
- 按单词搜索文件,然后在C++中打印特定行数
- C++ 尝试优化每一帧将数据打印到二进制文件
- 如何访问头文件中类的组件并打印它们的地址?
- 如何在c ++中以一行(水平)打印两个文件的数据?如给定的.这两种形式来自两个不同的文本文件
- 使用 fstream 库并在屏幕上打印的文件有问题?
- 如何在几个空行后打印文件中的输出
- 二进制文件以及如何对其采取行动(打印文件)
- C 获取目录路径,解析文件夹名称和来自Parent Directory的打印文件内容
- 打印文件中的文本
- 如何打印文件的内容
- 打印文件的分段故障特征
- 打印文件夹中的文件
- 用c++打印文件的第n列