Create File of X size

This is a discussion on Create File of X size within the C++ Programming forums, part of the General Programming Boards category; my bad.. was formated fat32.. df reports ntfs correctly got excited there for a moment......

  1. #16
    Registered User
    Join Date
    Jan 2009
    Posts
    10
    my bad.. was formated fat32.. df reports ntfs correctly

    got excited there for a moment...

  2. #17
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by jcas1411 View Post
    my bad.. was formated fat32.. df reports ntfs correctly

    got excited there for a moment...

    Ehm, but fat32 should also give correct free-size...

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #18
    Registered User
    Join Date
    Jan 2009
    Posts
    10
    my bad.. ntfs in linux isnt broken.. had a fat32 drive in.. sparse files fool fat32 but not ntfs..

    in Windows the CreateFile method is actually creating a handler for direct disk IO.. that is what I really want to do in Linux..

    sorry for the double post.. didnt see that it went to page 2
    Last edited by jcas1411; 01-26-2009 at 01:27 PM. Reason: my bad

  4. #19
    Registered User
    Join Date
    Jan 2009
    Posts
    10
    found my own answer.. maybe

    Windows uses unbuffered disk IO whereas Linux uses unbuffered file IO

    http://www.developer.com/net/cplus/a...0919_2119781_5

    nice help how to do on either platform via C

  5. #20
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by jcas1411 View Post
    found my own answer.. maybe

    Windows uses unbuffered disk IO whereas Linux uses unbuffered file IO

    http://www.developer.com/net/cplus/a...0919_2119781_5

    nice help how to do on either platform via C
    Both Windows and Linux normally uses buffered I/O - although memory cards/USB sticks are "unbuffered" because people tend to pull them out at almost any time - and it helps if half the data wasn't left dangling in the computers memory [that applies for WinXP onwards, pre-XP the buffering was done for all devices whcih is why you HAVE to "eject" a drive in Win2K etc, but not in WinXP].

    Both Linux and Windows also allow you to add flags when opening a file to say "do not buffer this" (that is the basic OS level file-functions, what the upper layer C or C++ library does with this capability is a different story).

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  6. #21
    Registered User
    Join Date
    Feb 2009
    Posts
    1
    >>>>>.... to create a file with an exact size x
    Did anybody consider to try ftruncate(), ftruncate64()?
    Last edited by ma5645; 02-07-2009 at 11:45 AM.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 03:44 PM
  2. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  3. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 03:30 PM
  4. Replies: 3
    Last Post: 03-04-2005, 01:46 PM
  5. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 09:46 AM

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