1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Error in opening the binary file for writing

Discussion in 'C' started by man4ish, Mar 27, 2009.

  1. man4ish

    man4ish New Member

    Joined:
    Apr 5, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Hi ,
    I am trying to open a file in binary to write. But I am getting the message
    "could not open the file".
    Code:
    fstream outCredit( "credit.dat", ios::in | ios::out | ios::binary );
    if ( !outCredit )
    {
    cerr << "File could not be opened." << endl;
    exit( 1 );
    }
    i am running on gcc version 4.2.4 (Ubuntu 4.2.4-1ubuntu3).

    What is the reason for this pblm.

    Regards
    Manish
    Reply
     
    Last edited by a moderator: Mar 31, 2009
  2. man4ish

    man4ish New Member

    Joined:
    Apr 5, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Sorry message is File could not be opened.Also I want to know if we convert file into binary then, will it take more time to read ?
     
  3. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    Please use code tags when posting code. Saves code being translated into stupid smilies.

    Does the file exist?
     

Share This Page