Jump to content

Disable error checking in c++

- - - - -

  • Please log in to reply
5 replies to this topic

#1
lysergicc

lysergicc

    Newbie

  • Members
  • PipPip
  • 13 posts
Hi. I want to know how to disable error checking. In pascal it's {$I-}. How it looks in c++?

#2
Flying Dutchman

Flying Dutchman

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 889 posts
  • Location:::1
Why would you wanna do that?
A conclusion is where you got tired of thinking.
#define class struct    // All is public.

#3
lysergicc

lysergicc

    Newbie

  • Members
  • PipPip
  • 13 posts
I have to write program that edit text files. And if program can't open text files it should give error message: 'Can't open text file'.

#4
mnirahd

mnirahd

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 330 posts
if you want to print an error in case a file wasn't open successfully you can use is_open() function as follow


ifstream file("test.txt")


if (!file.is_open())

{

   cout<<"I cannot open the file"<<endl;

   return 0;

}



I hope this helps!

Munir

#5
lysergicc

lysergicc

    Newbie

  • Members
  • PipPip
  • 13 posts
Thanks :)

#6
Flying Dutchman

Flying Dutchman

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 889 posts
  • Location:::1
Oh, did you mean how to check for errors? Because you wrote how to disable error checking.
A conclusion is where you got tired of thinking.
#define class struct    // All is public.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users