Article View: comp.os.msdos.programmer
Article #4118Re: Turbo C and ^Z's
From: marwk
Date: Fri, 04 Jan 1991 12:45
Date: Fri, 04 Jan 1991 12:45
19 lines
1336 bytes
1336 bytes
In article <OTTO.91Jan3125711@tukki.jyu.fi>, otto@tukki.jyu.fi (Otto J. Makela) writes: > In a fit of desperation, I wrote the following code to get rid of trailing > SUB's (^Z's, 0x1A) from MeSsy-DOS files, to make porting programs from Unix > easier... what am I doing wrong ? Or is it the compiler (I tried compiling > this with an ancient Turbo C 2.0) ? I've made similar code to work on Manx > Aztec C86 4.10d (a nice compiler, but sadly out of date). > -- > #include <stdio.h> > #include <fcntl.h> The method is to use the method of handles instead of streams. Use open (in binary mode), read, write, close. Read the reference manual on these. You could use flen = filelength(input handle) and read all of the data into a buffer but then you must be certain in advance that the last byte is the EOF marker (1A) and not data. Ray
Technical Details
Message-ID:
<15800.27847903@levels.sait.edu.au>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!munnari.oz.au!yoyo.aarnet.edu.au!sirius.ucs.adelaide.edu.au!levels!marwkReferences:
<OTTO.91Jan3125711@tukki.jyu.fi>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!munnari.oz.au!yoyo.aarnet.edu.au!sirius.ucs.adelaide.edu.au!levels!marwk From: marwk@levels.sait.edu.au Newsgroups: comp.os.msdos.programmer Subject: Re: Turbo C and ^Z's Message-ID: <15800.27847903@levels.sait.edu.au> Date: 4 Jan 91 12:45:54 GMT References: <OTTO.91Jan3125711@tukki.jyu.fi> Followup-To: comp.os.msdos.programmer Organization: Sth Australian Inst of Technology Lines: 19