-
-
Save amrhamedp/1b351395ceb3a11cf42d174db192cfb7 to your computer and use it in GitHub Desktop.
read file and do something line by line with c++
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <fstream> | |
| #include <sstream> | |
| using namespace std; | |
| int main(int argc, char* argv[]) | |
| { | |
| ifstream file(argv[1]); // pass file name as argment | |
| string linebuffer; | |
| while (file && getline(file, linebuffer)){ | |
| if (linebuffer.length() == 0)continue; | |
| // do something | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment