![]() |
| ||
| Building a Shell. I'm in Hell So I'm trying to build a shell, and I've been stuck for days just trying to think about how to take in the input from the user. I need to be able to have a list of dynamically growing commands, that each has its list of dynamically growing arguments, so that I can handle situations where pipes occur, or regular commands occur with arguments, or redirections etc. my first idea was make a struct of command types that held the char* command name, an array of arguments, and the size for the array of args. I could then make a vector of this. This idea seems pretty difficult to do though The second idea was make a vector of vectors of char*s. so like vector< <vector<char*> >, but this gives me errors like ISO C++ forbids items with no type. So i guess I cannot declare a vector of vectors? or am I declaring it wrong. I want the easiest possible way to do this, because I am just stuck on it for three days straight now. If someone could help me I would much appreciate it. |
| ||
| Re: Building a Shell. I'm in Hell You're declaring it wrong; that'd be vector< vector<char *> > |
| ||
| Re: Building a Shell. I'm in Hell Quote:
okay so problem with this vector of vector of chars is it prnts me garbage when i test it I have the take input functoin here:
From main i call the following: int main() This prints out command0 is: command1: (garbage prints here) etc.. Why isn't it echoing back what i typed into the command line for take input? I am missing something crucial here I think about C/c++ If you could point me in the right direction i would much appreciate. Thanks again for all of your continued help btw. |
| All times are GMT -4. The time now is 3:32 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC