Click here to Skip to main content
15,892,927 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: ofstream flags - create file... Pin
Arman S.25-May-07 2:09
Arman S.25-May-07 2:09 
GeneralRe: ofstream flags - create file... Pin
ldsdbomber25-May-07 2:14
ldsdbomber25-May-07 2:14 
GeneralRe: ofstream flags - create file... Pin
Arman S.25-May-07 2:57
Arman S.25-May-07 2:57 
GeneralRe: ofstream flags - create file... [modified] Pin
ldsdbomber25-May-07 3:02
ldsdbomber25-May-07 3:02 
QuestionRe: ofstream flags - create file... Pin
David Crow25-May-07 3:40
David Crow25-May-07 3:40 
AnswerRe: ofstream flags - create file... Pin
ldsdbomber25-May-07 3:51
ldsdbomber25-May-07 3:51 
GeneralRe: ofstream flags - create file... Pin
David Crow25-May-07 3:56
David Crow25-May-07 3:56 
GeneralRe: ofstream flags - create file... Pin
ldsdbomber25-May-07 4:05
ldsdbomber25-May-07 4:05 
thanks. the problem is I want to create a new file only if it doesn't exist and I can't get that to work. Unless I am being an idiot, the flag I need is ios::nocreate and this can be ORed in with the out flag

i.e.
FileDataStream.open(fileName, ofstream::out | ios::nocreate);


but when i do this, it is still making the file even when it doesn't exist. I don't know why one flag is ofstream and the other is ios, but ofstream::nocreate didn't seem to work.

Maybe I am just getting in a pickle with this, but I couldn't find a useful example that I could follow along, surely "open file for appending, unless it's not there in which case make a new one and write to it" must be a very commonly done thing!

Smile | :)
QuestionDialogs at design time Pin
mcsherry25-May-07 1:19
mcsherry25-May-07 1:19 
AnswerRe: Dialogs at design time Pin
Maximilien25-May-07 1:41
Maximilien25-May-07 1:41 
AnswerRe: Dialogs at design time Pin
Hamid_RT25-May-07 1:49
Hamid_RT25-May-07 1:49 
AnswerRe: Dialogs at design time Pin
toxcct25-May-07 3:10
toxcct25-May-07 3:10 
AnswerRe: Dialogs at design time Pin
David Crow25-May-07 3:17
David Crow25-May-07 3:17 
Questionpreview file while protecting Pin
anu jaggi25-May-07 1:01
anu jaggi25-May-07 1:01 
AnswerRe: preview file while protecting Pin
Cedric Moonen25-May-07 1:03
Cedric Moonen25-May-07 1:03 
GeneralRe: preview file while protecting Pin
Nelek25-May-07 1:13
protectorNelek25-May-07 1:13 
GeneralRe: preview file while protecting Pin
David Crow25-May-07 3:18
David Crow25-May-07 3:18 
QuestionRe: preview file while protecting Pin
Hamid_RT25-May-07 5:58
Hamid_RT25-May-07 5:58 
GeneralRe: preview file while protecting Pin
Mark Salsbery25-May-07 5:46
Mark Salsbery25-May-07 5:46 
AnswerRe: preview file while protecting Pin
Hamid_RT25-May-07 1:38
Hamid_RT25-May-07 1:38 
QuestionHow to get ID of standard Common DialogBox? Pin
Atul2325-May-07 0:46
Atul2325-May-07 0:46 
AnswerRe: How to get ID of standard Common DialogBox? Pin
Nelek25-May-07 1:11
protectorNelek25-May-07 1:11 
AnswerRe: How to get ID of standard Common DialogBox? Pin
Arman S.25-May-07 3:00
Arman S.25-May-07 3:00 
AnswerRe: How to get ID of standard Common DialogBox? Pin
David Crow25-May-07 3:19
David Crow25-May-07 3:19 
QuestionWord file Pin
ramidaJA25-May-07 0:22
ramidaJA25-May-07 0:22 

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.