how to create a file of specific size?

This is a discussion on how to create a file of specific size? within the C Programming forums, part of the General Programming Boards category; I want to know the syntax to create a file of specific size......

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    2

    how to create a file of specific size?

    I want to know the syntax to create a file of specific size...

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    fopen(), fwrite(), fclose() in that order.


    BTW this isn't really a place to request code.

  3. #3
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,236
    Quote Originally Posted by Mandark View Post
    I want to know the syntax to create a file of specific size...
    You need to fseek() forward the number of bytes you want, then fwrite() a byte at that location.

  4. #4
    Registered User
    Join Date
    Nov 2007
    Posts
    2

    sorry

    this is my first post and I did'nt know the forum rules.

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,451
    > this is my first post and I did'nt know the forum rules.
    So you missed all the posts at the top of each forum with titles like
    Forum Guidelines. Read before posting
    Click it NOW!
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File Writing Problem
    By polskash in forum C Programming
    Replies: 3
    Last Post: 02-13-2009, 09:47 AM
  2. Create File of X size
    By jcas1411 in forum C++ Programming
    Replies: 20
    Last Post: 02-07-2009, 11:42 AM
  3. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 03:44 PM
  4. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM
  5. File Size and File Size on Disk
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 12-15-2001, 07:03 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21