Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Testing if file open() command successful

Reply
Thread Tools

Testing if file open() command successful

 
 
Colum
Guest
Posts: n/a
 
      12-18-2003
Hi,
Does anyone know how to check if the ofstream open() command was successful.
My program tries to open a file on a floppy disk and I want to ensure that
the disk is present in the drive by checking if the open() command succeeded
Thanks
Colum


 
Reply With Quote
 
 
 
 
Moonlit
Guest
Posts: n/a
 
      12-18-2003
Hi,

"Colum" <(E-Mail Removed)> wrote in message
news:vdoEb.1404$(E-Mail Removed)...
> Hi,
> Does anyone know how to check if the ofstream open() command was

successful.
> My program tries to open a file on a floppy disk and I want to ensure that
> the disk is present in the drive by checking if the open() command

succeeded
> Thanks
> Colum
>
>


ofstream File( "a:\\file.txt" );

if( !File.is_open() )
{
cerr << " File is not open" << endl;
}

Regards, Ron AF Greve.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Successful validation still blocks postback nospamforjoel@yahoo.com ASP .Net 1 06-14-2005 03:16 PM
10093: successful WSAStartup not yet performed =?Utf-8?B?TUNoaWw=?= Wireless Networking 3 03-18-2005 12:39 AM
detecting successful downloads and browser buffering =?Utf-8?B?U2FtLUtpd2k=?= ASP .Net 2 12-08-2004 01:54 AM
Successful Download Tracking Mike Lavender ASP .Net 1 12-02-2003 08:14 PM
what are the possible reasons that successful pre-synthesis simulation + successful synthesis = failed post-synthes walala VHDL 4 09-08-2003 01:51 PM



Advertisments