ANSWERS: 3
  • Jeez, programming a command prompt is very complicated. Why don't you start out by programming IN the command prompt with something like Bash or Python before you try to do low-level operating system things.
  • Display the prompt: std::cout << "> " << std::flush; to act on it, read a std::string from std::cin and send it to the system() function.
  • This question confused me a bit but I will give it a shot. To write your own command prompt (which is a waste time because it is (forgive the cliche) reinventing the wheel. Can be done in either C++ or x86 assembly (provided you are using an intel processor for the later) there are different assemblers for each piece of hardware out there - they are all similar but some of the instruction sets can be proprietary. IMHO - writing assembly in Windows can be a waste time since you spend a lot of time calling into the windows DLL's to interact with the Windows operating system. There is an excellent book on Assembly Language called "Assembly Language Step By Step by Jeff Duntemann" it's a great place to start and shows in detail how to write assembly code for DOS (segmented and flat model memory) and Linux (protected memory model - this is also what NT 4 and above uses in the windows world - but the code you write for one os versus the other can be RADICALLY different. To find the book just google Assembly + Step By Step and you should find it on Amazon or someplace else. To write code that runs in the command prompt you can write what is known as a Console Application. This is a common place for C and C++ guys to start out before moving on to more complex things like MFC and C++ .NET winforms development. Or - you could just write batch files which are text files with the .bat extension (in the windows world - I can't answer anything about linux and apple didn't have a command prompt if I remember correctly (that was circa 1992 on a Macintosh LC III - things might have changed since system 7 which was the last Apple OS I have played with. Batch files are simple to write - they are basically a series of DOS commands that are executed sequentially. You comment the batch file with REM statements and there is even flow control available. For more information on how to write batch files go to this link... http://home7.inet.tele.dk/batfiles/batfiles.htm HTH

Copyright 2018, Wired Ivy, LLC

Answerbag | Terms of Service | Privacy Policy