个人笔记向+google机翻(机翻确实很多细节描述不清,看不懂记得参考原文)
原文参见:https://hackingcpp.com/cpp/be...
Input&Output
1.Command Line Arguments 命令行参数
- What &Why
How to Access in C++
int main (int const argc, char const* argv/*a pointer to a constant char*/) {
- Argument Conversion
Conversion to std::string, int, …
auto word = string(argv[1]); int times = atoi(argv[2]);
- String → Number Conversion Functions
2.File Input&Output 文件输入输出
- Write Text File
Read Text File
#include <fstream> std::ofstream os {"squares.txt"}; os << xxxxx ; std::ifstream is {"squares.tst"}; is >> xxxxx ;
Open/Close Files
os.open("squares.txt"); os.close("squares.txt");
- File Open Modes
3.Stream Input&Output 流输入输出
Example: Point Coordinate I/O
4.Recover From Input Error 从输入错误中恢复
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。