Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Error in opening the binary file for writing (http://www.go4expert.com/forums/error-binary-file-writing-t16690/)

man4ish 27Mar2009 14:46

Error in opening the binary file for writing
 
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

man4ish 27Mar2009 14:56

Re: Error in opening the binary file for writing
 
Quote:

Originally Posted by man4ish (Post 44911)
Hi ,
I am trying to open the file in binary mode to write the data but I am getting the message
"File could not be opened".

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.Sorry message is File could not be opened. Please do reply so that i can move ahead.

Regards
Manish
Reply

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 ?

xpi0t0s 27Mar2009 21:22

Re: Error in opening the binary file for writing
 
Please use code tags when posting code. Saves code being translated into stupid smilies.

Does the file exist?


All times are GMT +5.5. The time now is 03:16.