Click here to Skip to main content
15,917,062 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: What is "Window Station" Pin
Tomasz Sowinski26-Aug-02 4:57
Tomasz Sowinski26-Aug-02 4:57 
AnswerRe: What is "Window Station" Pin
Stephane Rodriguez.26-Aug-02 5:50
Stephane Rodriguez.26-Aug-02 5:50 
GeneralRe: What is "Window Station" Pin
Tomasz Sowinski26-Aug-02 5:52
Tomasz Sowinski26-Aug-02 5:52 
GeneralRe: What is "Window Station" Pin
Stephane Rodriguez.26-Aug-02 19:32
Stephane Rodriguez.26-Aug-02 19:32 
GeneralCreateFileMapping Pin
Mazdak26-Aug-02 4:48
Mazdak26-Aug-02 4:48 
GeneralRe: CreateFileMapping Pin
Tomasz Sowinski26-Aug-02 5:00
Tomasz Sowinski26-Aug-02 5:00 
GeneralRe: CreateFileMapping Pin
Mazdak26-Aug-02 5:13
Mazdak26-Aug-02 5:13 
GeneralElegant file use Pin
solosnake26-Aug-02 4:00
solosnake26-Aug-02 4:00 
Hello

I have a txt file I need to insert a string into at the start of. If the file does not exist I need to create it, and insert the line of txt.

What is the most elegant way of doing this using C++? An ugly ways seems to be to check if the file exists. If it doesn't, create, write and go home. If it does then I must make a copy of it, overwrite the original with my new line of txt, and then append the contents of my copy into this. This seems a real hack, and I am looking for a nicer way? Perhaps there is some nice strstream method?

Looking forward to replies...

solosnake


GeneralRe: Elegant file use Pin
Pavel Klocek26-Aug-02 4:36
Pavel Klocek26-Aug-02 4:36 
GeneralRe: Elegant file use Pin
Tomasz Sowinski26-Aug-02 4:38
Tomasz Sowinski26-Aug-02 4:38 
GeneralRe: Elegant file use Pin
Pavel Klocek26-Aug-02 10:11
Pavel Klocek26-Aug-02 10:11 
GeneralRe: Elegant file use Pin
solosnake26-Aug-02 4:57
solosnake26-Aug-02 4:57 
GeneralRe: Elegant file use Pin
Brian Azzopardi26-Aug-02 4:59
Brian Azzopardi26-Aug-02 4:59 
GeneralRe: Elegant file use Pin
Tomasz Sowinski26-Aug-02 5:02
Tomasz Sowinski26-Aug-02 5:02 
GeneralRe: Elegant file use Pin
solosnake26-Aug-02 5:12
solosnake26-Aug-02 5:12 
GeneralRe: Elegant file use Pin
Tomasz Sowinski26-Aug-02 5:19
Tomasz Sowinski26-Aug-02 5:19 
GeneralRe: Elegant file use Pin
Brian Delahunty26-Aug-02 5:35
Brian Delahunty26-Aug-02 5:35 
GeneralRe: Elegant file use Pin
Tomasz Sowinski26-Aug-02 5:38
Tomasz Sowinski26-Aug-02 5:38 
GeneralRe: Elegant file use Pin
Brian Delahunty26-Aug-02 6:32
Brian Delahunty26-Aug-02 6:32 
GeneralMultilanguage resource problem Pin
Andreas Saurwein26-Aug-02 3:35
Andreas Saurwein26-Aug-02 3:35 
GeneralRe: Multilanguage resource problem Pin
Tomasz Sowinski26-Aug-02 3:42
Tomasz Sowinski26-Aug-02 3:42 
GeneralRe: Multilanguage resource problem Pin
Andreas Saurwein26-Aug-02 3:54
Andreas Saurwein26-Aug-02 3:54 
GeneralRe: Multilanguage resource problem Pin
Tomasz Sowinski26-Aug-02 3:56
Tomasz Sowinski26-Aug-02 3:56 
GeneralRe: Multilanguage resource problem Pin
Andreas Saurwein26-Aug-02 4:11
Andreas Saurwein26-Aug-02 4:11 
GeneralRe: Multilanguage resource problem Pin
Tomasz Sowinski26-Aug-02 4:23
Tomasz Sowinski26-Aug-02 4:23 

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.