I have a for loop that takes in user input and it displays on a new line, however with input redirection, everything prints on the same line
for example if i manually type ls
the results would be: src makefile bin
the input looks like
1 2
$ ls
src makefile bin
but if I use input redirection ./a.out <ls.txt
it appears as
$ src makefile bin
is there a way i can make the input on the next line without so make it look like i manually typed ls?
this is my for loop
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
info();
for(string line = ""; getline(cin,input);)
{
info();
//output the username and the host machine
//this seperates the command into a vector
SubStrBuilder(comVector,input);
//turns the vector into postfix notation
comVector = infix_to_postfix(comVector);
//return the top node
master = compose_tree(comVector);
//if there is a valid Shell * to execute
if(master != NULL)
{
master->execute();
}
}