mercredi 5 avril 2017

C++ passing arguments File

I want to execute a program passing parameters as a whole "file", example:

program < file.txt

input inside file.txt:

123
hello
c++

the code:

int main (){  
         char parameters[256];  
         cin.get(parameters,256);  
         cout << parameters;  
         exit(0);  
    }

I want the output to be
123
hello
c++

i always get only "123" as output everytime, i even tryed in diferent ways but the output is always the same... Anyone can help? thanks

Aucun commentaire:

Enregistrer un commentaire