added a function to truncate and rewind a file to frontend.c