![]() |
|
#1
|
|||
|
|||
I need help on C++ Uni ProjectI have to work on a project and i cannot find a way to solve this:
Develop a MS DOS command prompt emulator, that has the following DOS commands: CLS VER DIR CD DOSKEY HELP EXIT Any ideas? Thank you |
|
#2
|
|||
|
|||
Re: I need help on C++ Uni Projectsystem('command prompt command');
read up or research on this system function for more information. |
|
#3
|
|||
|
|||
Re: I need help on C++ Uni Projectthank u!
if i understand what u said before, i can use dos commands, using system("command"), is that right? it seems to work with system("CLS") if you like take a look at my code: CPP / C++ / C Code:
I still need help for the following: - The commands DIR, DOSKEY and CD - How can I make my program work for more than one command each time? When i run it, i can only type one command. When i type a second one, the program closes. THANK YOU! Last edited by LuciWiz : 02-May-2006 at 07:24.
Reason: Please insert your C++ code between [c++] & [/c++] tags
|
|
#4
|
|||
|
|||
Re: I need help on C++ Uni Projectwhether or not the command is a valid or invalid one. system('command'); will automatically handle that if it does not recognize the command.
Remember it is emulating/imitating the command prompt, so it will spit out whatever a regular command prompt does. System will handle these calls without you checking the input strings passed in. Example system("DIR"); system("nonsense"); |
|
#5
|
|||
|
|||
Re: I need help on C++ Uni ProjectAlso stuff what you have in main into a function, and you can either use a loop to call the function more than one times or recursion.
|
|
#6
|
||||
|
||||
Re: I need help on C++ Uni ProjectI am quite sure that calling DOS commands from your program to emulate DOS is not going to get you a good grade. I'll bet the requirement is to "write the code that processes the command" so you need to write the steps to accomplish the task, not simply call DOS.
Make each command a function. This will keep your code easier to read and debug. __________________
Age is unimportant -- except in cheese |
|
#7
|
|||
|
|||
Re: I need help on C++ Uni ProjectQuote:
That is true... So any ideas for CLS Command? I have tried to clear the screen like this: Code:
But it doesnt seem to work... - I think VER, HELP and EXIT commands are OK. - DOSKEY: I think i will try to create a LOG file or something - DIR: I found something, it looks easy www.informit.com - CD: I have no idea... ANY HELP??? Thank you |
|
#8
|
|||
|
|||
Re: I need help on C++ Uni ProjectCLS: don't know why that doesn't work, perhaps it doesn't flush the buffer. try using endl instead of "\n". On specific operating systems there are several options for clearing the screen, detailed here: http://faq.cprogramming.com/cgi-bin/...&id=1043284385
CD: you could keep an internal variable of the current directory, or if on Windows you can use the Get/SetCurrentDirectory functions. |
|
#9
|
||||
|
||||
Re: I need help on C++ Uni ProjectQuote:
__________________
Age is unimportant -- except in cheese |
Recent GIDBlog
Flickr uploads of IA pictures by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need help with Simple 1D Array coding project | rho | C++ Forum | 2 | 27-Jun-2005 19:05 |
| c programming : project idea ??? | batrsau | C++ Forum | 2 | 09-Jun-2005 04:55 |
| project in c | pointer | C Programming Language | 1 | 26-Apr-2005 15:46 |
| Community Project Proposal | dsmith | Miscellaneous Programming Forum | 71 | 19-Feb-2005 12:26 |
| Help with project. | anignna | C Programming Language | 12 | 27-Apr-2004 07:51 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The