Skip to content

Instantly share code, notes, and snippets.

@knutsun
Created May 15, 2011 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save knutsun/973490 to your computer and use it in GitHub Desktop.
Save knutsun/973490 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ifstream infile;
char string[81];
infile.open("data.txt");
if(!infile)
{
cerr << "Error: file could not be opened" << endl;
return 1;
}
infile.getline(string, 81);
int a = 0;
for(int k=0; k < string[a]; a++)
{
cout << string[a] << endl;
}
infile.close();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment