S
skinnay
i have a program that has two parts, the first part populates a list
with a loop and cin.getline(). the second part is a command prompt to
manipulate the list. i have the first part done, and can use a
redirected file as input. (./main < data.txt) but after the first loop
i want it to drop to a command prompt. is this possible?
the program works fine without redirecting a file, but cin will not
wait for user input in the second loop when redirecting a file.
main()
{
// 1st loop
while(!end of file flag)
{
cin.getline(str);
list.append(str);
}
// command promt loop
while(!exit)
{
cout << "$ " ;
// this will not wait for input when supplied with
// redirected file
cin >> buf;
...
/* handle commands - manipulate list */
...
}
}
thanks
with a loop and cin.getline(). the second part is a command prompt to
manipulate the list. i have the first part done, and can use a
redirected file as input. (./main < data.txt) but after the first loop
i want it to drop to a command prompt. is this possible?
the program works fine without redirecting a file, but cin will not
wait for user input in the second loop when redirecting a file.
main()
{
// 1st loop
while(!end of file flag)
{
cin.getline(str);
list.append(str);
}
// command promt loop
while(!exit)
{
cout << "$ " ;
// this will not wait for input when supplied with
// redirected file
cin >> buf;
...
/* handle commands - manipulate list */
...
}
}
thanks