Skip to content

Instantly share code, notes, and snippets.

@blaquee
Created June 7, 2013 22:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blaquee/5732931 to your computer and use it in GitHub Desktop.
Save blaquee/5732931 to your computer and use it in GitHub Desktop.
GetCurrentdir Test 1
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <iterator>
int main(int argc, const char * argv[]){
std::ifstream in("testfile.txt");
std::vector<std::string> vec;
if(in){
std::string s;
while(std::getline(in, s))
{
vec.push_back(s);
//print each line to output stream
std::ostream_iterator<std::string> out(std::cout,"\n");
std::copy( vec.begin(), vec.end(), out );
}
}
else{
std::cout << "file open error" << std::endl;
} return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment