// Display a file using get().
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char *argv[])
{
char ch;
if(argc!=2) {
cout << "Usage: PR <name>\n";
return 1;
}
ifstream in(argv[1], ios::in | ios::binary);
if(!in) {
cout << "Cannot open file.\n";
return 1;
}
while(in) { // in will be false when eof is reached
in.get(ch); // while (in.get(ch))
if(in) cout << ch; // cout << ch;
} // get() returns the stream in
in.close(); // in will be false when eof
return 0;
}
ياليت احد يفهمني سالفة الcommand line parameter
و البرنامج هذا ما فهمت ايش الفايدة منه , يعني ما قرا CHARS و لا شي , اللي فاهم يفعمني لوسمحتو
وشككككككككككرا