Date: Mon, 12 Dec 1994 15:02:12 GMT+0100 From: IBBT0 AT cc DOT uab DOT es Subject: Help about truncating files To: djgpp AT sun DOT soe DOT clarkson DOT edu Organization: Universitat Autonoma de Barcelona Hello, people! I am writting a program that allows doing different changes over pree= xisting files. One of the options is to erase an important part of the end of the file. To do this one possible solution is to rename the file and = to rewrite the first part over a new file with the original name. Of cou= rse this is slow and probably there is a better solution, but I cannot fi= nd it. In other words, I am asking you for a instruction, if possible workin= g in ANSI C and using streams (fopen(),...), not file handles, to inform t= he operating system and the File Allocation Table I want truncate the fi= le. Note I work with binary data files and I want a real truncation, not = only a visual one in the case of "type"; I want my next "dir" command report= ing a smaller number of bytes. So the solution of putting a "Ctrl+Z" in the= end of a text file is not useful for me. I have test putting my FILE pointer to the approprite part of the fil= e with fseek() and doing the following: FILE *stream; long int offset; : fgetpos (stream, &offset); fsetpos (stream, &offset); : but it does not work. I work under a DOS-Windows environment. Thank you very much for your help!! Xavier Pons Centre de Recerca Ecol=95gica i Aplicacions Forestals, CREAF. Universitat Aut=95noma de Barcelona. 09193. Bellaterra Catalonia. Spain.