<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>C++ way of setting file position for file sizes larger than 32-bits? - C++ - tribe.net</title>
    <link>http://cpp.tribe.net/thread/5627843f-1135-4e23-97ef-11fc13a693a1?format=rss</link>
    <description>Tribe.net. Local Connections</description>
    <item>
      <title>Re: C++ way of setting file position for file sizes larger than 32-bits?</title>
      <link>http://CPP.tribe.net/thread/5627843f-1135-4e23-97ef-11fc13a693a1#b0995a48-9613-4063-9582-acdacc3003e6</link>
      <description>I can't speak for other platforms but there is fsetpos() which I think is standard.   I don't know that it does a clear and you may be on your own for that.&#xD;
&#xD;
This is Windows specific but when dealing with huge files under Windows I use MapViewOfFile()/UnmapViewofFile() which memory map a window into your file in multiples of SYSTEM_INFO.dwAllocationGranularity using the system's virtual memory functions.</description>
      <pubDate>Wed, 08 Nov 2006 07:55:04 GMT</pubDate>
      <guid isPermaLink="false">http://CPP.tribe.net/thread/5627843f-1135-4e23-97ef-11fc13a693a1#b0995a48-9613-4063-9582-acdacc3003e6</guid>
      <dc:creator>Hypno</dc:creator>
      <dc:date>2006-11-08T07:55:04Z</dc:date>
    </item>
    <item>
      <title>C++ way of setting file position for file sizes larger than 32-bits?</title>
      <link>http://CPP.tribe.net/thread/5627843f-1135-4e23-97ef-11fc13a693a1#41813685-1e0d-468e-b2cf-4e9532096a24</link>
      <description>Hello, all ...&#xD;
&#xD;
I need to create a file and set it to a specific size (the idea being that there is another thread that uses std::ofstream::seekp() to write blocks to the file as they arrive off of the network, likely out of order, so if the 10th block of the file arrives before the 1st, I need to be able to handle it).  The thing is, std::ofstream::seekp() doesn't seem to allow me to seek past the end of the file and set the file position there e.g. it sets the failbit true if I try.  In C, I used to do this with feek(), so I could code something like this:&#xD;
&#xD;
fseek( pFile, 10000000, SEEK_SET ); // makes the file 10000000 bytes long if it was shorter before&#xD;
&#xD;
... but fseek() expects a long for the seek position, and this is 2006, where a long isn't big enough (files could be much larger than 4G).  I have to do this in a portable way (Windows and Mac OSX / *nix).&#xD;
&#xD;
Ideas?&#xD;
&#xD;
Regards,&#xD;
&#xD;
John, looking for a simple solution&#xD;
&#xD;
Falling You - exploring the beauty of voice and sound&#xD;
http://www.fallingyou.com</description>
      <pubDate>Tue, 07 Nov 2006 19:48:45 GMT</pubDate>
      <guid isPermaLink="false">http://CPP.tribe.net/thread/5627843f-1135-4e23-97ef-11fc13a693a1#41813685-1e0d-468e-b2cf-4e9532096a24</guid>
      <dc:creator>John Michael</dc:creator>
      <dc:date>2006-11-07T19:48:45Z</dc:date>
    </item>
  </channel>
</rss>



