View topic - Abou creating a FILE with fixed SIZE

Abou creating a FILE with fixed SIZE

For the old QNX2 and QNX4 RTOS

Abou creating a FILE with fixed SIZE

Postby kurma1248 » Thu Oct 23, 2008 6:33 am

Hi friends,

i have one question related with file.

Q: how to create a file with specified size.?

if for example, file size is 500k. If we are writing in to a file, how to know that file size is reached upto 80% of max file size, which we mentioned file siaze while creating.?
New Member
Posts: 4
Joined: Mon Jul 28, 2008 5:33 am

Postby vjay » Thu Oct 23, 2008 1:08 pm

Try truncate() and i beleive u can keep track how many bytes ur writing to the file.
Active Member
Posts: 10
Joined: Tue Aug 19, 2008 2:39 am

Postby cnzxy » Mon Oct 27, 2008 1:31 am

you can fopen() a new file,
then fseek() a specified size,
then fclose() this file.
finally you get a file with specified size.

later when you will write the file, you can use ftell() to get the position of file pointer.
Active Member
Posts: 25
Joined: Mon Feb 28, 2005 2:39 am

Return to QNX2 and QNX4

Who is online

Users browsing this forum: No registered users and 2 guests