Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!ames!ucbcad!ucbvax!decvax!decwrl!pyramid!oliveb!intelca!mipos3!omepd!uoregon!hp-pcd!hpcvlo!bill From: bill@hpcvlo.UUCP Newsgroups: comp.sys.ibm.pc Subject: Re: Truncating DOS files Message-ID: <1610006@hpcvlo.HP.COM> Date: Wed, 18-Feb-87 13:51:13 EST Article-I.D.: hpcvlo.1610006 Posted: Wed Feb 18 13:51:13 1987 Date-Received: Sat, 21-Feb-87 16:00:59 EST Organization: Hewlett-Packard Co., Corvallis, OR, USA Lines: 59 Okay, you folks who can't seem to find any documentation about truncating DOS files, I just looked through both of my DOS reference manuals (an old 2.11 reference from Microsoft, and a 3.2 manual from IBM), and BOTH of them spell out quite plainly the fact that calling Int 21h Function 40H with CX=0 will truncate a file: ******************** "Disk Operating System Technical Reference" (for DOS versions 2.10, 3.00, 3.10 and 3.20) First Edition (February 1985) Copyright IBM 1985, 1986 Part No. 6138536 "DOS Interrupts and Function Calls" chapter, page 6-129: 40H Write to a File or Device To truncate a file at the current position of the file pointer, set the number of bytes (CX) to zero before issuing the interrupt 21H. The file pointer can be moved to the desired position by reading, writing, and performing function call 42H (Move File Read/Write Pointer)." ... ******************** "Microsoft MS-DOS Operating System Programmer's Reference Manual" (for DOS version 2.0) Copyright Microsoft Corp. 1981, 1983 Document No. 8411-200-00 Part No. 14F36PM SYSTEM CALLS chapter, page 1-117: Write to a File or Device (Function 40H) ... The write system call with a count of zero (CX = 0) will set the file size to the current position. Allocation units are allocated or released as required. ... ******************** Do I have the only two pieces of documentation in existance that mention this fact, or is everybody else just looking in the wrong places? Bill Frolik hp-pcd!bill Hewlett-Packard Portable Computer Division Corvallis, Oregon