Click here to Skip to main content
15,905,781 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: C++ file handling Pin
Greg Utas18-Nov-23 8:42
professionalGreg Utas18-Nov-23 8:42 
AnswerRe: C++ file handling Pin
k505418-Nov-23 8:59
mvek505418-Nov-23 8:59 
AnswerRe: C++ file handling Pin
jschell20-Nov-23 7:30
jschell20-Nov-23 7:30 
Saboor Sarfraz wrote:
but instead of moving the cursor to the beginning of the current line it moves the cursor to the next line


Nope. A 'file' never ever does that.

Rather you are attempting to display the file using something else.

And that something else, not the file, is doing that.

Saboor Sarfraz wrote:
for the purpose of overwriting the existing txt.


Your code is absolutely correct. For what you state the purpose is.

So the problem is, as I stated above.

If you are on a windows machine you can open a Powershell console or a 'cmd' console. They are NOT the same.

Presumably you are using one of those then running your exe.

So try doing it with the other one.

If perhaps you are using an Apple Mac then you are perhaps out of luck since it always interprets the '\r' in the way you are seeing it behave.

modified 21-Nov-23 11:21am.

Question&foo[bar] or (foo + bar) ? Pin
honey the codewitch16-Nov-23 11:48
mvahoney the codewitch16-Nov-23 11:48 
AnswerRe: &foo[bar] or (foo + bar) ? Pin
k505416-Nov-23 16:14
mvek505416-Nov-23 16:14 
GeneralRe: &foo[bar] or (foo + bar) ? Pin
JudyL_MD17-Nov-23 3:15
JudyL_MD17-Nov-23 3:15 
AnswerRe: &foo[bar] or (foo + bar) ? Pin
CPallini16-Nov-23 20:08
mveCPallini16-Nov-23 20:08 
GeneralRe: &foo[bar] or (foo + bar) ? Pin
Peter_in_278017-Nov-23 18:28
professionalPeter_in_278017-Nov-23 18:28 
GeneralRe: &foo[bar] or (foo + bar) ? Pin
Richard MacCutchan17-Nov-23 22:11
mveRichard MacCutchan17-Nov-23 22:11 
AnswerRe: &foo[bar] or (foo + bar) ? Pin
Richard MacCutchan16-Nov-23 21:29
mveRichard MacCutchan16-Nov-23 21:29 
AnswerRe: &foo[bar] or (foo + bar) ? Pin
jschell17-Nov-23 5:36
jschell17-Nov-23 5:36 
GeneralRe: &foo[bar] or (foo + bar) ? Pin
honey the codewitch17-Nov-23 5:38
mvahoney the codewitch17-Nov-23 5:38 
GeneralRe: &foo[bar] or (foo + bar) ? Pin
trønderen17-Nov-23 8:35
trønderen17-Nov-23 8:35 
GeneralRe: &foo[bar] or (foo + bar) ? Pin
honey the codewitch17-Nov-23 8:37
mvahoney the codewitch17-Nov-23 8:37 
GeneralRe: &foo[bar] or (foo + bar) ? Pin
trønderen17-Nov-23 11:07
trønderen17-Nov-23 11:07 
GeneralRe: &foo[bar] or (foo + bar) ? Pin
jschell20-Nov-23 7:11
jschell20-Nov-23 7:11 
GeneralRe: &foo[bar] or (foo + bar) ? Pin
honey the codewitch20-Nov-23 7:20
mvahoney the codewitch20-Nov-23 7:20 
AnswerRe: &foo[bar] or (foo + bar) ? Pin
JudyL_MD17-Nov-23 7:53
JudyL_MD17-Nov-23 7:53 
GeneralRe: &foo[bar] or (foo + bar) ? Pin
honey the codewitch17-Nov-23 7:53
mvahoney the codewitch17-Nov-23 7:53 
GeneralRe: &foo[bar] or (foo + bar) ? Pin
JudyL_MD17-Nov-23 8:08
JudyL_MD17-Nov-23 8:08 
AnswerRe: &foo[bar] or (foo + bar) ? Pin
RedDk17-Nov-23 12:05
RedDk17-Nov-23 12:05 
AnswerRe: &foo[bar] or (foo + bar) ? Pin
RedDk18-Nov-23 9:38
RedDk18-Nov-23 9:38 
GeneralRe: &foo[bar] or (foo + bar) ? Pin
trønderen18-Nov-23 9:54
trønderen18-Nov-23 9:54 
GeneralRe: &foo[bar] or (foo + bar) ? Pin
RedDk18-Nov-23 10:55
RedDk18-Nov-23 10:55 
AnswerRe: &foo[bar] or (foo + bar) ? Pin
trønderen18-Nov-23 11:35
trønderen18-Nov-23 11:35 

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.