|
-
March 24th, 2006, 05:56 AM
#1
What is the reason of file open failure?
hello,
I'm programming a simulation of a disk.
I was told to use the try/catch mechanism to catch I/O errors.
This is a part of a function i'm using,
dskfl is an instance of fstream.
PHP Code:
void disk::mountdisk(String sFilename)
{
dskfl.open(sFilename.GetBuffer(),ios::in);
if (!dskfl.is_open())
{
//what to put here?
}
Sector sec;
dskfl >> sec;
What do i need to put in the !is_open(), if i want to throw an exception (with the reason of the error!!!) to the caller of the function?
Thanks!
InfraRed.
Please rate my post, if it helped you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|