Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

MinGW program

Name: Anonymous 2007-07-03 16:01 ID:QeLHvrNT

I'm porting a small app from linux to windows and I need a replacement for truncate() function

will this:

FILE *file;
char *path="/tmp/aaa.txt";
long outpos;
file = fopen(path);
/* some code changing file */
chsize(file->_file, outpos);
fclose(file);

work as in the same way as truncate()?

Name: Anonymous 2007-07-04 13:23 ID:8b1G1TJh

>>8
The FILE structure is to be treated as an abstract object and only to be accessed through functions like in >>9. Everything inside is implementation specific and shouldn't be touched. Doing so reduces your portability severely, potentially limiting the code to only your platform and MinGW version.
From the MinGW stdio.h:

/*
 * The structure underlying the FILE type.
 *
 * Some believe that nobody in their right mind should make use of the
 * internals of this structure. Provided by Pedro A. Aranda Gutiirrez
 * <paag@tid.es>;.
 */

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List