Windows – ftruncate trunc file in c cannot find this function

c++filewindows

I want to truncate the file something like setsizeof() with FILE *
I'm developing vs 2003 windows

#include <unistd.h> there's no such lib

how can I do it freopen() truncates all the data vut doesn't write- getting EINVAL error
some help?????

Best Solution

_chsize function does the job better it get fd ans size to change to