Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- File: P607N4.cpp
- Description: Reads in a file and prints every other character
- Programmer: Shrimant Saxena
- */
- #include <iostream>
- #include <fstream>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- char charvar;
- ifstream inFile("test.dat");
- if (inFile.fail() )
- {
- cout << "The file failed to open.";
- exit(1);
- }
- while (!inFile.eof())
- {
- inFile.ignore(1);
- inFile.get(charvar);
- cout << charvar << " ";
- inFile.peek();
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement