Click here to Skip to main content
15,896,278 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralPlease delete your reply. Pin
CPallini6-May-08 2:28
mveCPallini6-May-08 2:28 
Questionrunning single instance of a exe Pin
Le@rner6-May-08 1:01
Le@rner6-May-08 1:01 
AnswerRe: running single instance of a exe Pin
CPallini6-May-08 1:07
mveCPallini6-May-08 1:07 
GeneralRe: running single instance of a exe Pin
Rajesh R Subramanian6-May-08 1:10
professionalRajesh R Subramanian6-May-08 1:10 
GeneralRe: running single instance of a exe Pin
CPallini6-May-08 1:15
mveCPallini6-May-08 1:15 
AnswerRe: running single instance of a exe Pin
Hamid_RT6-May-08 1:10
Hamid_RT6-May-08 1:10 
AnswerRe: running single instance of a exe Pin
toxcct6-May-08 1:43
toxcct6-May-08 1:43 
Questionstl:fstream exeption-handling and file-closing [modified] Pin
Tomerland6-May-08 0:46
Tomerland6-May-08 0:46 
Dear developers,

I have the following code:


try {
    ifstream file;
    file.open("file.txt");
	
	file >> ... ;	
    file.close();	
}
catch(......) {
  ...
  ---> do I have to close the file here? <----
}


My question:
Do I have to close the file in the catch-handler? Or is it automatically closed when the destructor of file runs.


Kind regards


PS:
Another question: How can I insert code here with indentation?

modified on Tuesday, May 6, 2008 7:06 AM

AnswerRe: stl:fstream exeption-handling and file-closing Pin
Rajesh R Subramanian6-May-08 0:58
professionalRajesh R Subramanian6-May-08 0:58 
QuestionRe: stl:fstream exeption-handling and file-closing Pin
CPallini6-May-08 1:01
mveCPallini6-May-08 1:01 
AnswerRe: stl:fstream exeption-handling and file-closing Pin
toxcct6-May-08 1:40
toxcct6-May-08 1:40 
AnswerRe: stl:fstream exeption-handling and file-closing Pin
Tomerland6-May-08 1:45
Tomerland6-May-08 1:45 
Questionhelp me please Pin
sofia_1116-May-08 0:39
sofia_1116-May-08 0:39 
AnswerRe: help me please Pin
Rajkumar R6-May-08 0:52
Rajkumar R6-May-08 0:52 
GeneralRe: help me please Pin
sofia_1116-May-08 5:31
sofia_1116-May-08 5:31 
QuestionRe: help me please Pin
Rajesh R Subramanian6-May-08 0:55
professionalRajesh R Subramanian6-May-08 0:55 
AnswerRe: help me please Pin
sofia_1116-May-08 5:35
sofia_1116-May-08 5:35 
QuestionRe: help me please Pin
CPallini6-May-08 0:57
mveCPallini6-May-08 0:57 
JokeRe: help me please Pin
Rajesh R Subramanian6-May-08 1:00
professionalRajesh R Subramanian6-May-08 1:00 
JokeRe: help me please Pin
CPallini6-May-08 1:04
mveCPallini6-May-08 1:04 
AnswerRe: help me please Pin
sofia_1116-May-08 5:37
sofia_1116-May-08 5:37 
QuestionHelp! How to convert an array to bitmap? Pin
npkinh6-May-08 0:30
npkinh6-May-08 0:30 
AnswerRe: Help! How to convert an array to bitmap? Pin
ThatsAlok6-May-08 0:35
ThatsAlok6-May-08 0:35 
GeneralRe: Help! How to convert an array to bitmap? Pin
npkinh6-May-08 1:00
npkinh6-May-08 1:00 
GeneralRe: Help! How to convert an array to bitmap? Pin
Nelek6-May-08 2:02
protectorNelek6-May-08 2:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.