Reading C ++ files

Source: Internet
Author: User

Simple Write c ++ for File ReadingCodeTo keep your memory, write it down:

# Include <fstream> # include <string> # incclude <iostream> using namespace STD; void main () {string s; ifstream fin; ofstream fout; Fin. open ("F: \ 1.txt"); fout. open ("F: \ 1.txt"); While (! Fin. EOF () {Getline (FIN, S); // a row is read into fout <S <'\ n';} fin. close (); fout. close (); System ("pause ");}

System ("pause ");

System isProgramTo call system commands (and shell commands ). System ("pause") is to call the "pause" command from the program;
The function of the "pause" system command is very simple, that is, to output a line similar to "press any key to exit" on the command line, wait for the user to press a key, and then return.

C ++ files are read in many ways, and there are many related function interfaces. In the future, we will continue to consult relevant materials for improvement.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.