Solved

Shell ?

Posted on 1998-11-17
6
329 Views
Last Modified: 2010-04-15
hi guys,
i would like to know how to do a dos shell like the one in turbo c or borland c++.i wanna know how to save the current environment and then restore it back.I am working in borlannd c++ under dos platform.
0
Comment
Question by:girishr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 3

Expert Comment

by:braveheart
ID: 1254356
This has nothing to do with C so it is the wrong topic area.

However, what you could do is pipe the output of "set" to a file  and edit the file to make a suitable batch file. This can then be executed to restore your environment.
0
 

Author Comment

by:girishr
ID: 1254357
hi braveheart,
i did not understand ur reply at all.well i am doing a program in C in which i need to do a dos shell.i hope u understand my Q right...please tell me why it has nothing to do with c (as u said)
0
 
LVL 3

Accepted Solution

by:
arnond earned 20 total points
ID: 1254358
I think I understand what you're trying to do:
do something like this:

while (1)
{
   read_command_from_stdin();
   understand_what_command_was_given_and_execute_appropriate_routine();
}

read_command_from_stdin() will read the command line (with scanf() or something like that) into a command string.
understand_what_command_was_given_and_execute_appropriate_routine() will find out which command was enetred, see if it's a known command and execute the relevant routine or function for that command.

If you need more help, just ask.
Arnon David.

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:braveheart
ID: 1254359
Sorry, I misunderstood your question. I did not realise that you are trying to write a shell but thought you were having trouble using the DOS environment. After all, DOSSHELL is a specific product.
0
 
LVL 3

Expert Comment

by:arnond
ID: 1254360
as for saving the current environment, use a struct that will hold the environment inf and have a file to write all the environment info to and then you can always read from it and save changes to it.

Arnon David.
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 1254361
it was long time ago, when I programmed on DOS, but as far as i remember

"i would like to know how to do a dos shell ..."
aren't you supposed to free as much memory as you can (leave only a small module in memory) and start new command proccess (execute COMMAND.COM)

"i wanna know how to save the current environment and then restore it back"
as far as i remember a proccess CAN'T change the enviroment of its father proccess. Every proccess receives a copy of the enciroment of its father proccess, manipulates it and then frees it. Are you trying to inform your father procces about changes in your own enviroment ?

  heyhey
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

631 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question