Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

DOS prompt from external programm (Developers)

posted by tkchia Homepage, 30.09.2020, 18:19

Hello GizMo79,

> I have created my own text editor from which I can program and compile
> programs, I have inserted a function to start a DOS prompt leaving the
> editor in the background, I get this with the system function
> ("c:\command.com"); but this uses a lot of memory because I have 2
> "command.com" active in addition to the editor, is it possible to jump to
> the command.com already loaded in memory without loading another one?

Maybe, instead of saying something like system(getenv("COMSPEC")), you can use one of the spawn...(...) functions --- spawnve, spawnl, etc. --- which will likely come with whichever DOS compiler you are using.

Saying system(getenv("COMSPEC")) will most likely spawn a new copy of (e.g.) c:\command.com to run the command "c:\command.com". That is, it will spawn _two_ new copies of command.com, which is of course needlessly wasteful.

If you just want to run command.com without giving it any command, you can just use spawn...(...) directly with the value of COMSPEC. This will create just one new copy of command.com in memory.

Thank you!

---
https://gitlab.com/tkchia · https://codeberg.org/tkchia · 😴 "MOV AX,0D500H+CMOS_REG_D+NMI"

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 238 users online (0 registered, 238 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum