File in Append Mode
-
Hi, I created a file in append mode using CreateFile();.But if I reopen the file add add string to it, it is appending from the starting of the file. But it should be added from the end of the file. What is wrong?
can u send ur code...so that i can get clearly.
Born to win...!
-
Hi, I created a file in append mode using CreateFile();.But if I reopen the file add add string to it, it is appending from the starting of the file. But it should be added from the end of the file. What is wrong?
AFAIK CreateFile has no 'append' option: you have to go to the end of the file (via
SetFilePointer
) after opening it correctly for append (i.e. depending on your needs, withOPEN_ALWAYS
orOPEN_EXISTING
asdwCreationDisposition
parameter) and start writing there. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
Hi, I created a file in append mode using CreateFile();.But if I reopen the file add add string to it, it is appending from the starting of the file. But it should be added from the end of the file. What is wrong?
Do you need to CFile::Seek?
-
Do you need to CFile::Seek?
Yes, he does ;)
Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
-
Yes, he does ;)
Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
I think yes,Hi Nelek how are you.
-
I think yes,Hi Nelek how are you.
Fine thanks, a bit away of VC++ but trying not to forget :P I changed job and city.
Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
-
Fine thanks, a bit away of VC++ but trying not to forget :P I changed job and city.
Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
I guess maybe you forgot me. ;)
-
I guess maybe you forgot me. ;)
No, I just forgot to check messages contents from forums notices :rolleyes: :laugh: ;P , just saved all and now that I had time... I have made clean up answering and keeping the ones I consider to be kept. It was a long time without coming to forums :P I will get more often so... see you in the posts ;):cool:
Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson