Closing a file, file handle, let me explain. 
Author Message
 Closing a file, file handle, let me explain.

DOS ONLY.
Is is possible to stop a program already running by executing a C
program that grabs the file handle of the running program and closing
the file?

Basically, I want to exit the running .exe program progmatically, or is
that pragmatically <g>.

Thanks

Larry

--

Quote from Reuters News 2/10/97: "Tobacco companies maintain
they do not ``spike'' cigarettes with nicotine and that
nicotine is not {*filter*}ive. "
Do we really want tobacco companies selling cookies ????
http://www.*-*-*.com/



Thu, 17 Feb 2000 03:00:00 GMT  
 Closing a file, file handle, let me explain.


l> DOS ONLY.

Don't post on c.l.c, then.  comp.os.msdos.programmer would probably be
a better choice.

l> Is is possible to stop a program already running by executing a C
l> program that grabs the file handle of the running program and closing
l> the file?

C programs don't have associated file handles, unless you explicitly
open them with fopen().  Even on OS's and OS shells where programs are
occasionally partially loaded from disk, this is handled
transparently; the application has no way to get at the file handle
the OS uses.

l> Basically, I want to exit the running .exe program progmatically, or is
l> that pragmatically <g>.

This _is_ an ANSI C question; look at the exit() function.


Not in a text-based newsreader, I can't.  And not when I read news
messages that are plain-text (as they should be) and not HTML.  <grr>

--
 _____________________________
/                             \  "...electronic spam is about as appealing
|          David Maze         |   as the luncheon meat of the same name..."

| http://donut.mit.edu/dmaze/ |  -- _The San Jose Mercury News_,
\_____________________________/                              August 8, 1997



Thu, 17 Feb 2000 03:00:00 GMT  
 Closing a file, file handle, let me explain.

Quote:
> Don't post on c.l.c, then.  comp.os.msdos.programmer would probably be
> a better choice.

Ok...I'll post the question to comp.os.msdos.programmer.

Quote:

> l> Is is possible to stop a program already running by executing a C
> l> program that grabs the file handle of the running program and closing
> l> the file?
> C programs don't have associated file handles, unless you explicitly
> open them with fopen().  Even on OS's and OS shells where programs are
> occasionally partially loaded from disk, this is handled
> transparently; the application has no way to get at the file handle
> the OS uses.

A few years ago I had a shareware program called Mark and Release. In
case your not familiar with the two, Mark marks a location in memory
then any executable loaded after MARK is run is loaded above this
address.  Later, if you want a quick release, call RELEASE from from a
batch file and the executable vanishes.

Couldn't this be achieved with C?

Quote:

> This _is_ an ANSI C question; look at the exit() function.

Ok....I have looked at the exit function.  All I can gain is that it
exits the calling process and returns to the OS.  This is what I want to
accomplish in the child process.

Quote:

> Not in a text-based newsreader, I can't.  And not when I read news
> messages that are plain-text (as they should be) and not HTML.  <grr>

Unfortunate.

Thanks



Thu, 17 Feb 2000 03:00:00 GMT  
 Closing a file, file handle, let me explain.

Quote:

> > Don't post on c.l.c, then.  comp.os.msdos.programmer would probably be
> > a better choice.

> Ok...I'll post the question to comp.os.msdos.programmer.

> > l> Is is possible to stop a program already running by executing a C
> > l> program that grabs the file handle of the running program and closing
> > l> the file?

> > C programs don't have associated file handles, unless you explicitly
> > open them with fopen().  Even on OS's and OS shells where programs are
> > occasionally partially loaded from disk, this is handled
> > transparently; the application has no way to get at the file handle
> > the OS uses.

> A few years ago I had a shareware program called Mark and Release. In
> case your not familiar with the two, Mark marks a location in memory
> then any executable loaded after MARK is run is loaded above this
> address.  Later, if you want a quick release, call RELEASE from from a
> batch file and the executable vanishes.

> Couldn't this be achieved with C?

 Hi, Larry.
 These programs dealt with DOS TSR's; of course, they could be written
in C - but, addressing system-specific problem, they had to be written
in a system-specific manner - they have to deal with DOS idiosyncrasies.
So DOS-specific newsgroup is the best place to ask - ANSI C itself
doesn't know anything about TSR's.

        Regards,
                Alex Krol



Fri, 18 Feb 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. let visual c++ handle *.cc same as *.cpp files

2. Closing A File Handle (Best Place To Make The Function Call)

3. Closing A File Handle (Best Place To Make The Function Call)

4. Catching File->Open and File->Close

5. FILE * <-> System File Handles

6. CInternetFile/CHttpFile has no valid FILE* or file handle

7. CHttpFile/CInternetFile has no valid FILE* or file handle

8. Please let me know where to find odbc.inf file required by SQLInstallODBC

9. how to let VC7 link to files outside of project scope

10. Q: How to let the download file open automatically

11. Can some explain to me .tlh files?

12. Let me Know when to use CFile::Close();

 

 
Powered by phpBB® Forum Software