[comp.os.msdos.programmer] File truncation in MSDOS?

sir@hq.demos.su (Sergey Ryzhkov) (05/21/91)

Dear netpeoples.

I have 2 small question about MS-DOS programming.
I work with MS-DOS 3.30 and Turbo C 2.0. May anybody help
programmer from Moscow.

The first question.

How I can truncate the tail of the file i.e. delete the part of
the file from the current position to the eof. Are there any
system service in DOS to do this?

The secomd question.

How I can to insert the keyboard key combination Ctrl+Shist?
I have no problem with such combinations as Ctrl+PgUp or Shift+Ins.
But Ctrl+Ins do not generate any input from function getbios () or
any other. What can I do?

I am not regulary news reader, so if it is not hard for you
answer me to my address sir@hq.demos.su or sir@s514.ipmce.su.

			Sergey Ryzhkow, Moscow, Russia, USSR

valley@gsbsun.uchicago.edu (Doug Dougherty) (05/22/91)

sir@hq.demos.su (Sergey Ryzhkov) writes:

>How I can truncate the tail of the file i.e. delete the part of
>the file from the current position to the eof. Are there any
>system service in DOS to do this?

lseek to the spot, then write 0 bytes.  Works every time...

>How I can to insert the keyboard key combination Ctrl+Shist?
>I have no problem with such combinations as Ctrl+PgUp or Shift+Ins.
>But Ctrl+Ins do not generate any input from function getbios () or
>any other. What can I do?

You can't.  Assuming that what you want to do is pop up a TSR via
programmatic control, you have to wire yourself into the TSR's INT 9
handler, and trick it into thinking the key combination was struck (even
though it wasn't).  I have done this with several TSR's, but there is 
no general way to do it (i.e., no way which involes just pushing the key
combination)

>			Sergey Ryzhkow, Moscow, Russia, USSR

An obvious fake.  The USSR no longer exists.  (I know they changed their
name recently; don't know off hand what the new name is...)
--

	(Another fine mess brought to you by valley@gsbsun.uchicago.edu)