Este codigo (C++) muestra el contenido del archivo de texto, que se le pase como parametro, en pantalla:
Código:
#include <iostream>
#include <ios>
#include <fstream>
#include <string>
using namespace std;
void main(int argc, char **argv)
{
if (argc < 2 ) { return; }
fstream lectura(argv[1], ios::in);
string word;
for (; !lectura.eof();)
{
getline(lectura, word);
cout << word << endl;
}
}