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 9:43 ID:+9Bg4orM

>>7
as for errors, i was writing from memory, not copypasted it from  program, it should be
file=fopen(path,"r+");
and
truncate(path, outpos);

ftruncate() does exacly the same what chsize() does..

the question is: is _file field in FILE struct the file descriptor which i can use with ftuncate() or chsize()?

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