c++ string format
来源:互联网 发布:ppt转换视频软件 编辑:程序博客网 时间:2024/06/05 09:19
利用stringstream类
stringstream ss;
ss<<"hhh"<<value<<"\t"<<"hh";
stringstream ss;
ss<<"hhh"<<value<<"\t"<<"hh";
string str=ss.str();
code:
#include <iostream>#include <fstream>#include<string>#include<sstream>using namespace std;int main () { ofstream ofile ("D:\\example.txt"); int value=123; stringstream ss; if (ofile.is_open()) { /*ofile << "This is a line.\n"; ofile << "This is another line.\n";*/ ss<<"hhh"<<value<<"\t"<<"hh"; ofile<<ss.str(); ofile.close(); } else cout << "Unable to open file"; string line; ifstream ifile ("D:\\example.txt"); if (ifile.is_open()) { while ( getline (ifile,line) ) { cout << line << '\n'; } ifile.close(); } else cout << "Unable to open file"; return 0;}
- String.Format举例(C#)
- C#,String.Format()
- String.Format(C#)
- C#String.Format大全
- C#,String.Format,数字格式化输出 ,format
- String Format for Double [C#]
- String Format for Double [C#]
- String Format for DateTime [C#]
- String Format for Double [C#]
- String Format for Double [C#]
- c#string.format入门(1)
- 详解C#string.Format性能
- System.String.Format里"{0:C}"是什么意思。
- .net(C#)中String.Format如何使用
- .net(C#)中String.Format如何使用
- c#中的string.format方法使用秘笈
- C#: String.Format() 数字格式化输出
- String.Format举例(C#,VB.Net)
- Cocosd-x设计模式之五 :防御式编程模式
- POJ_2485 Highway_Kruskal
- 15-HEVC中的图像的分块分割方法
- Android Service学习之AIDL, Parcelable和远程服务
- Cocosd-x设计模式之六 :组合模式
- c++ string format
- DI依赖注入
- s3c2440的LED点灯裸机C程序
- 数据库质疑修复总结 For SQL Server 2000/2005/2008/2008R2
- erlang random sort
- LeetCode (U)
- oracle11G空表默认不导出怎么解决
- Android--WindowManager.LayoutParams(上)
- 计算机系统会议论文是如何评审的 -- 读后笔记