Results 1 to 6 of 6

Thread: FSWriteFork in MAC OS to write data to a file.

  1. #1
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question FSWriteFork in MAC OS to write data to a file.

    Hi All,

    I m using Qt 4.1.5 on my MAC.

    I am reading raw data from disk and writing them to buffer and then trying to write that Buffer in file through FSWriteFork which is in FileSystem API of the Apple.
    I m using the following line

    error
    Qt Code:
    1. = FSWriteFork(refnum,fsFromStart,NULL,(ByteCount)SizeToRead,pBuff, NULL);
    To copy to clipboard, switch view to plain text mode 

    But if I use fsFromStart it always write the buffer at the starting that is suppose I want to write 4 Gb data from the disk to file and I read a 20 MB buffer and write it in a loop to the buffer the final size of the file will only be 20 MB instead of 4 GB.

    there are other value as well
    fsAtMark
    fsFromStart
    fsFromLEOF
    fsFromMark

    But I donot know which value should I use to write whole size and then be able to open the file.


    If anybody knows then plz help me.

    Thanks.

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: FSWriteFork in MAC OS to write data to a file.

    You should use fsFromMarker.
    It means you're writing beginning at the current file position. If you write 20mb, then the current file pos is at the end.

  3. #3
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question Re: FSWriteFork in MAC OS to write data to a file.

    Thanks for reply.

    Actually I m writing total data 4 GB but because I can not read buffer of 4 GB from harddisk I m reading 20 MB at a time and then write it to the fork using this function and so..on until total of 4 GB written to the file.

    If I use fsAtMark with FSWriteFork then if I get the size of file it is 4 GB but if I open it with Hex Editor then it says No Resource Fork found then what should I do?

  4. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: FSWriteFork in MAC OS to write data to a file.

    I suggested using fsFromMark, not the other one.

    Regards

  5. #5
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: FSWriteFork in MAC OS to write data to a file.

    Position Mode Constants
    Together with an offset, specify a position within a fork.

    enum {
    fsAtMark = 0,
    fsFromStart = 1,
    fsFromLEOF = 2,
    fsFromMark = 3
    };
    Constants
    fsAtMark
    The starting point is the access path’s current position. The offset is ignored.

    Available in Mac OS X v10.0 and later.

    fsFromStart
    The starting point is offset bytes from the start of the fork. The offset must be non-negative.

    Available in Mac OS X v10.0 and later.

    fsFromLEOF
    The starting point is offset bytes from the logical end of the fork. The offset must not be positive.

    Available in Mac OS X v10.0 and later.

    fsFromMark
    The starting point is offset bytes from the access path’s current position. The offset may be positive or negative.

    Available in Mac OS X v10.0 and later.

    Discussion
    These constants are used in the ioPosMode and positionMode fields and parameters of the HFS and HFS Plus file access functions. These functions include those for reading from and writing to files or forks, changing the current position within a file or fork, changing the size of a file or fork, and allocating space to a file or fork.

    For the FSReadFork and FSWriteFork calls, you may also add either of the pleaseCacheMask or noCacheMask constants to hint whether the data should be cached or not. See Cache Constants.
    There it is.
    Regards

  6. #6
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question Re: FSWriteFork in MAC OS to write data to a file.

    Thanks Marcel.

    Actually I think its the error of HexEdit I m using It can not open file larger than 2 GB.

    So can u suggest any hexeditor which can open the file larger than 2 GB.

Similar Threads

  1. qt-3.3.8 fail in scratchbox
    By nass in forum Installation and Deployment
    Replies: 0
    Last Post: 25th May 2007, 15:21
  2. Uic cannot write output file
    By jobrandt in forum Qt Tools
    Replies: 4
    Last Post: 25th May 2007, 07:55
  3. who can give me a tutorials of write .pro file
    By fengtian.we in forum Qt Programming
    Replies: 5
    Last Post: 20th May 2007, 16:25
  4. Transferring data input from a Widget to a cpp file
    By Ahmad in forum Qt Programming
    Replies: 1
    Last Post: 10th March 2007, 09:59
  5. Replies: 3
    Last Post: 23rd June 2006, 17:46

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.