Fstream can't read or write files 4GB even with -m64?

Using C++-style streams, I have been unable to read or write files >4GB. For example, when writing 5GB in one go, I get only 1GB. The header for write uses the type streamsize for the size parameter, and according to sizeof, streamsize is 8 bytes (when using -m64). Looking at the assembly for a simple testcase, I verified that size parameter was not truncated before calling the write function.
What makes this interesting is that I can read or write large files if I do it in the C-style (fopen, fwrite, fclose) or if I use the C++ functions and manually do it in 1GB blocks. I tried the instructions for LFS, but they didn't work and it seems like it shouldn't since this is C++ and I am building a 64-bit app. I have observed this with solaris studio 12.3 and 12.4.
Is this a bug or am I missing a compiler flag?
A simple testcase to expose this:
#include <iostream>
#include <fstream>
#include <stdio.h>
using namespace std;
int main() {
  streamsize goal_size = ((int64_t) 1<<32) + ((int64_t) 1<<30);
  cout << goal_size << endl;
  char* data = new char[goal_size];
  fill(data,data+goal_size,'c');
  FILE* f = fopen("classic.data","w");
  fwrite(data,1,goal_size,f);
  fclose(f);
  fstream file("stream.data", std::ios::out | std::ios::binary);
  file.write(data,goal_size);
  file.close();

Eh... sorry, didnt read the source close enough
I can reproduce your misbehavior when compiling "by default" (with default -library=Cstd).
It fails somewhat differently with Apache STL (-library=stdcxx4), which is kinda the modern version of Cstd.
It works fine when compiling with -library=stlport4, or -library=stdcpp (-std=c++11).
Looks like it is a deficiency of those particular STLs.
regards,
  Fedor.

Similar Messages

  • Can not read or write to mac hard drive error

    When attempting to transfer music files from an external usb harddrive formatted in windows into Itunes, I can only successfully import a small fraction of the music, and then its stops with a error, that the Mac HD can not read or write files.

    It's possible the file names have some 'funky' characters in them that the Mac doesn't like ?
    What format is the external drive ?

  • Can't read or write some files, internet is failing, youtube won't load, software I tried to install was in Slovenian, not dutch or english like in my systempreferences settings, pictures and files won't preview with spacebar, etc. Malware?

    Specs:
    iMac 10.8.5
    3,4 GHz Intel Core i7
    32 GB 1600 MHz DDR3
    Can't read or write some files, internet is failing, youtube won't load, security software I tried to install was in Slovenian, not dutch or english like in my systempreferences settings, pictures and files won't preview with spacebar and are randomly corrupted, when I entered something in the Youtube searchbar (when it was still working) it send me to a site with sexadds.
    I tried restart my iMac and when I was logged back in, my dock preferences were reset.
    Also tried to download some security software to check my Mac for malware, but when I did, I tried several, I got a notification that said something like 'dumpfiles (don't know if this is the right translation...) damaged'.
    I'm taking screenshots from all the weird notifications I get and even three quarters off the screenshots I took in the last three hours are already unreadable.
    It started this morning when I tried opening a Premiere Pro file on which I worked the night before.
    When I tried opening it, it said the file was damaged and could not be openend.
    I tried opening it with AE or importing the file in a new project but nothing helped.
    When I tried looking for autosaves, this is the really weird part, there were none.
    Even though there are autosaves from my other projects, this one was completely gone.
    It looked like the day before never happened on my computer.
    Also when I openend Premiere all the recent projects had been wiped.
    So at first I thought it was a Premiere Pro failure.
    But than, later on the day, I tried loading some RAW files from my compact flash card.
    This is where I would get an error (error -36) which said some data cannot be read or written.
    I tried importing the files with a view different technics, from dragging to importing via Lightroom and I succeeded with Image Browser.
    But when I tried moving the files to an other folder the same error occurred.
    While dealing with this issue I wanted to put on some soothing music on youtube.
    This is when the next weird thing occurred: youtube wasn't completely loading in Chrome. I refreshed a view times, checked the internet connection and still no difference.
    When I tried in Safari it did work but when I clicked enter on the searchbar in Youtube, a page with sexadds appeared (I didn't install AdBlock in Safari...).
    I read about this 'phishing' where you are redirected to a site were a possible malware installment can take place...
    I don't know if it's connected to any of the problems I've been having but I just never experienced this on a mac, I have been a Mac user for 10 years now.
    On top of it all, internet started working worse and worse and now it's not even working at all. I had to fill in the password over and over, normally it remembers.
    Just like my system preferences, all the preferences I had with Chrome where also reset.
    Also somewhere in between I got this notification: Mac OS X must restore library to run programs. Type your password to allow.
    To me this is all very weird and suspicious. I have clearly no idea what's going on. Could this be another sort of trojan horse or malware?
    Some background info which could be helpful for solving this mystery:
    two months ago the one year old Fusion Drive in my iMac just broke out of nowhere.
    I got it replaced by a qualified apple repair store.
    When I got my computer back, all the files where gone.
    I got on the internet without AdBlock installed yet.
    A game or whatever it was, can't clearly remember, got installed by accident.
    I deleted it immediately.
    Only two weeks later, I couldn't log in to my account. It didn't recognize my password and username. 
    So I brought my mac back to the store.
    Here the repair guy said it was a minor thing and he just needed to reconnect my account. He also mentioned he found a downloaded game name Sparta and it probably had something to do with the error.
    I asked him; could it be a virus? He replied no way.
    I don't know why I couldn't be a virus, just because it's a mac doesn't mean it cannot be done.
    So today I tried installing anti virus software (such as avast- was in a weird language looked like slovenian, clamxav - was in slovenian) but I couldn't install them.
    PLEASE help me! I don't know what to do anymore, I work fulltime and I need my computer, I have no time to bring it in for repair, are there other perhaps easier ways?
    Could this be the work of a virus or a malware? Or is it a disk permissions issue?

    It sounds like you may have multiple problems, but none of them are likely to be caused by malware.
    First, the internet-related issues may be related to adware or a network compromise. I tend to lean more towards the latter, based on your description of the problem. See:
    http://www.adwaremedic.com/kb/baddns.php
    http://www.adwaremedic.com/kb/hackedrouter.php
    If investigation shows that this is not a network-specific issue, then it's probably adware. See my Adware Removal Guide for help finding and removing it. Note that you mention AdBlock as if it should have prevented this, but it's important to understand that ad blockers do not protect you against adware in any way. Neither would any kind of anti-virus software, which often doesn't detect adware.
    As for the other issues, it sounds like you've got some serious corruption. I would be inclined to say it sounds like a failing drive, except it sounds like you just got it replaced. How did you get all your files back after the new drive was installed?
    (Fair disclosure: I may receive compensation from links to my sites, TheSafeMac.com and AdwareMedic.com, in the form of buttons allowing for donations. Donations are not required to use my site or software.)

  • What do I need to do to be able to read and write files to a Seagate Backup Plus Slim Portable Drive on BOTH a Mac and a PC? I downloaded "Paragon NTFS for Mac" onto my Mac, so now I can write to the drive, but when I plug it into a PC it won't work.

    What do I need to do to be able to read and write files to a Seagate Backup Plus Slim Portable Drive on BOTH a Mac and a PC? I downloaded "Paragon NTFS for Mac" onto my Mac, so now I can write to the drive, but when I plug it into a PC it won't work.

    If the HDD is formatted NTFS, then it suggests that there is a problem with the PC.  Check with the manufacturer.
    Ciao.

  • How can one  read a Excel File and Upload into Table using Pl/SQL Code.

    How can one read a Excel File and Upload into Table using Pl/SQL Code.
    1. Excel File is on My PC.
    2. And I want to write a Stored Procedure or Package to do that.
    3. DataBase is on Other Server. Client-Server Environment.
    4. I am Using Toad or PlSql developer tool.

    If you would like to create a package/procedure in order to solve this problem consider using the UTL_FILE in built package, here are a few steps to get you going:
    1. Get your DBA to create directory object in oracle using the following command:
    create directory TEST_DIR as ‘directory_path’;
    Note: This directory is on the server.
    2. Grant read,write on directory directory_object_name to username;
    You can find out the directory_object_name value from dba_directories view if you are using the system user account.
    3. Logon as the user as mentioned above.
    Sample code read plain text file code, you can modify this code to suit your need (i.e. read a csv file)
    function getData(p_filename in varchar2,
    p_filepath in varchar2
    ) RETURN VARCHAR2 is
    input_file utl_file.file_type;
    --declare a buffer to read text data
    input_buffer varchar2(4000);
    begin
    --using the UTL_FILE in built package
    input_file := utl_file.fopen(p_filepath, p_filename, 'R');
    utl_file.get_line(input_file, input_buffer);
    --debug
    --dbms_output.put_line(input_buffer);
    utl_file.fclose(input_file);
    --return data
    return input_buffer;
    end;
    Hope this helps.

  • How can I read the bootstrap files and extract the fragment-URLs and fragment-numbers in plain text?

    How can I read the bootstrap files of any HDS Live stream and extract the fragment-URLs and fragment-numbers in plain text?
    Could it be that it is some kind of compressed format in the bootstrap? Can I uncompress it wirh  f4fpackager.exe? Could not find any download for f4fpackager.exe. I would prefere less code to do so. Is there something in Java of JavaScript, that can extract the fragment-numbers?
    Thank you!

    Doesn't sound too hard to me. Your class User (the convention says to capitalize class names) will have an ArrayList or Vector in it to represent the queue, and a method to store a Packet object into the List. An array or ArrayList or Vector will hold the 10 user objects. You will find the right user object from packet.user_id and call the method.
    Please try to write some code yourself. You won't learn anything from having someone else write it for you. Look at sample code using ArrayList and Vector, there's plenty out there. Post in the forum again if your code turns out not to behave.

  • Help. External Hard drive "In use," can't read or write

    I was copying files from my iMac desktop to an external drive that I have been using for years. Suddenly, the drive didn't complete the operation. Now I can't read or write. Permissions seem fine. Tried to verify and repair in disc utility, but got a "unable to unmount disc" message. Then drive has to be force ejected. Rebooting is stalled until I unplug the drive. Can't even create a disc image of it. Tried booting in safe mode to do Disc Utility - no dice. Any help? Desparate.
    Douglas

    Oh... in use... see if Spotlight or Time Machine is trying to use it.
    Open Console in Applications>Utilities & see if there are any clues or repeating messages when this happens.

  • Since I upgrade to Lion OS my optical drive stop working can't read or write at all I did what I could to fix it but still not working , any help please

    Since I upgrade to Lion OS my optical drive stop working can't read or write at all I did what I could to fix it but still not working , any help please

    It sounds like you may have multiple problems, but none of them are likely to be caused by malware.
    First, the internet-related issues may be related to adware or a network compromise. I tend to lean more towards the latter, based on your description of the problem. See:
    http://www.adwaremedic.com/kb/baddns.php
    http://www.adwaremedic.com/kb/hackedrouter.php
    If investigation shows that this is not a network-specific issue, then it's probably adware. See my Adware Removal Guide for help finding and removing it. Note that you mention AdBlock as if it should have prevented this, but it's important to understand that ad blockers do not protect you against adware in any way. Neither would any kind of anti-virus software, which often doesn't detect adware.
    As for the other issues, it sounds like you've got some serious corruption. I would be inclined to say it sounds like a failing drive, except it sounds like you just got it replaced. How did you get all your files back after the new drive was installed?
    (Fair disclosure: I may receive compensation from links to my sites, TheSafeMac.com and AdwareMedic.com, in the form of buttons allowing for donations. Donations are not required to use my site or software.)

  • Why can't read access log file in real-time? (Oracle Weblogic Server 10.3)

    We can't read access log file in real-time. If access log is rotation to new file so can read access log file but can't read real-time.
    *** Oracle Weblogic Server versions 10 R3

    what's your meaning? try this command "tail -f access.log".
    Threre is a buffer about 8K for WebLogic to write the access info into the log files, so you can't see the access info untill the buffer is full.

  • Read and write files

    i am using IE as brower,. how do i change the properties so that i can let an applet to read and write files on my system? thank you, for help.

    DON'T POST MULTIPLE TIMES!
    Proper English:
    I am using Internet Explorer as my web browser. How do I change the properties so that an applet can read and write files to my local system? Thanks for any help.
    Answer) Search on Java and security in the forum search or google. This topic is covered numerous times.
    DeltaCoder

  • How can I read an excel file .xls from an forms 6i

    Hi
    I have forms6i and webutil don t work with this version, can I read an excel file from forms6i.
    Thank u

    Hi hosoriol,
    You can refer an excel as an external table first using the steps below and then you can start reading from it.
    If you want to update the excel file then create an view and create instead of triggers for it.
    Steps
    h3. 1.[Create an external table for the excel file |http://www.adp-gmbh.ch/ora/misc/ext_table.html|Click here to view detailed description]
    h4. 1. Create a directory in Oracle where you have kept the xls file
    create or replace directory ext_dir as '/home/rene/ext_dir';h4. 2. grant read, write on directory ext_dir to scott;
    h4. 3. creating the external table
    create table ext_table_csv (
                                                i   Number,
                                                n   Varchar2(20),
                                                m   Varchar2(20)
                     organization external (
                                                     type   oracle_loader
                                                     default directory ext_dir
                                                    access parameters (
                                                                                 records delimited  by newline
                                                                                 fields  terminated by ','
                                                                                  missing field values are null
                                                   location ('file.csv')
                     reject limit unlimited;
    Note_
    If you want to update the excel file then create a view and then create the instead of triggers to do the update, delete or insert.[Creating views on external tables | http://www.dba-oracle.com/oracle_news/2005_9_1_updating_external_tables.htm]
    h3. 2. Use the data block wizard and connect to the corresponding schema and create a database block.
    Kindly click Correct or Helpful if it helps Thanks :-)

  • I have the latest downloadable version of LR5.  It crashed while it was createing 1:1 previews during an import. After a Win7(64) restart, it shows a message that LR needs to quit because it can't read the preview files and it will try to fix it the next

    I have the latest downloadable version of LR5.  It crashed while it was createing 1:1 previews during an import. After a Win7(64) restart, it shows a message that LR needs to quit because it can't read the preview files and it will try to fix it the next time is launches.  I get the same message the next and every subsequent time it launches so I can't launch LR at all now.
    I get that the preview file got corrupted somehow.  Is there some way to fix this problem without building a new catalog?

    Use Windows Explorer to open the folder containing your catalog. You will see a folder with the extension .lrdata. You need to delete that folder and then start Lightroom again. Lightroom will generate a new previews folder.

  • "Can't Read Or Write to disk" Video Won't Transfer To Ipod

    I have transfered videos to my ipod in the past but I have two tv shows from the Itunes story that won't transfer.
    They are in the correct mpeg 4 whatever format. My itunes is the most resent version, but for some reason I keep getting the same error.
    "Cannot Read Or Write To Disk".
    HELP??!!
      Windows XP  

    I've got this problem too. My 5g iPod 30gig syncs after about 3 minutes with iTunes then after loading songs and videos after 10 minutes i get the same message your getting - "Can't Read Or Write to disk". I think theres some kind of USB2 conflict or something. All my other USB devices work fine. All my drivers and software is up-to-date.

  • WARNING: Cannot "Read or Write" files on iPod

    My iPod has been behaving very curiosly as of late. For the past month a wanring has flashed up on my iTunes screen when attempting to sync music files. The warning says *"Cannot read the disk 'iPod'. Unable to read or write files"*. Despite this warning my iPod has been able to update daily podcasts without issue. However, when I recently purchased new music I could not get it to sync to my iPod. I have no problem listening to this new album in my iTunes library, but it just will not sync to my iPod. I created a playlist for it and attempted to add it, but I discovered that the iPod was not syncing the playlists either!
    In a recent attempt to remedy the problem I selected only to sync the playlist that had the new album. What happened was frightening. All my music was no longer on the iPod, with the exception of my podcasts! I tried altering the settings to return all the music, but now I am unable to add any of my music from the library.
    I am wondering if anyone has experienced this difficulty before, and if so, if they have any trouble shooting techniques. I have already been ti Apple's support page and completed the 5 recommended steps, to no avail. Any suggestions or thoughts as to what might be occuring.

    Luckily, backing up your itunes library is easy. Just duplicate the folder(s) with your music in it. (Most likely, it's user/Music/ITunes.) Once the copy is made, you might want to move it to a different part of your hard drive.
    Now, restoring your ipod WILL wipe the device. If there's anything on your ipod that isn't in your itunes library (unlikely but possible), you want to make sure you've got a copy of it somewhere before restoring.
    Before restoring, check to see if there is an update to the ipod's firmware that needs to be installed. This is a "longshot" but might help. Just click the "check for update" button on the ipod's "Summary" pane in itunes. (Current version is 1.2.3, I think).

  • Can't read or Write to disc

    Using Windows XP I get an error (can't read or write to disc) when trying to sync my Ipod. It also says not enough room on disc at times.I was able to do this before. But it now fails. I sent the Ipod in for repair, it was stated that it needed disc repair. So I had it done. When I received it back and tried to use it I got the same errors. I was all ready to call the repair company and complain, but decided to try it on my computer using Vista. Everything works fine there. But now on the one using Xp. Anyone have any ideas on what might be the problem?

    Hi, did you ever have this issue resolved? I am now having the same problem. I was told that they hadn't a clue to what was going on and to make an appt to bring my laptop, external hard drive AND my iPhone in order to see what the problem is. I'd really like to know what you found out. I'm a home-school teacher and my phone is everything!
    Thank you

Maybe you are looking for

  • Mac OS X Lion works on Macbook Air with Processor Intel dual core?

    Mac OS X Lion works on Macbook Air with Processor Intel dual core?

  • Converting .rdf data model to xml output thru conc program

    Dear Members : I am trying to convert .rdf data model(Reports 10g) into XML tag, by creating Concurrent Program Report Definition, setting output type as XML.But when running the CP, getting following error: XML Parsing Error: XML declaration not wel

  • Command - Tab shortcut not working

    My command - tab shortcut stops working after a random period of time and I have to restart my MacBook to get it working again. Any idea what could be causing this keyboard shortcut to fail? I tried killing and re-running the Dock but that does not f

  • Change Sales Order, Delivery, Billings Reports

    Hi Gurus, Can any body please tell me is there any Report for change logs of Change Sales Order, Delivery, Billings & Change report of Customer & Material, Regards, Sai

  • Fonts and Infinality

    This is not so much of an issue as more a query to test I understand this correctly. Basically I installed the ubuntu patch fonts to get what I felt might be more attractive fonts, but it turned out too blurry for my liking, moreso than actual Ubuntu