Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / C++ and fstream

Author
Message
Spooter
16
Years of Service
User Offline
Joined: 27th May 2008
Location:
Posted: 16th Dec 2008 21:28 Edited at: 16th Dec 2008 21:51
This doesn't really have anything to do with DarkGDK, but you guys are the only people who have actually helped me so here is my question.

I'm making a logger function for my program. It's basically a call when you type in like function(aMessage_); and it will send the string to the file with this code.


This works just fine and it does what it is supposed to, but the logger currently overrides whatever text is in the document and puts in the new text. How can I make the logger go down a line, and insert the aMessage_ into that line?
Thanks



FIXED: I figured out the problem, here is how i solved.)


/*================================================*\
| Lead Programmer/Owner===============Anti-Triangle Cult=====|
\*================================================*/
RanQor
17
Years of Service
User Offline
Joined: 8th Jun 2007
Location:
Posted: 16th Dec 2008 21:42 Edited at: 16th Dec 2008 21:46
Here some VB code, maybe this can be applied to similarly with c++?
http://www.devx.com/vb2themax/Tip/19387
Spooter
16
Years of Service
User Offline
Joined: 27th May 2008
Location:
Posted: 16th Dec 2008 21:45 Edited at: 16th Dec 2008 21:48
FIXED

/*================================================*\
| Lead Programmer/Owner===============Anti-Triangle Cult=====|
\*================================================*/
RanQor
17
Years of Service
User Offline
Joined: 8th Jun 2007
Location:
Posted: 16th Dec 2008 21:49
Ah, I found something:
http://www.codersource.net/cpp_file_io.html

But instead of ios:in use ios::app
Spooter
16
Years of Service
User Offline
Joined: 27th May 2008
Location:
Posted: 16th Dec 2008 21:50
Yup Thankx

/*================================================*\
| Lead Programmer/Owner===============Anti-Triangle Cult=====|
\*================================================*/
Spooter
16
Years of Service
User Offline
Joined: 27th May 2008
Location:
Posted: 16th Dec 2008 22:41
OK now I have this problem, I want to set the time in front of the Submitted Text but the couted stuff after the time is dropped down a line.
Code:


And the output looks like this

[Tue Dec 16 15:40:59 2008
]This is the inputed string.


Got any suggestions?

/*================================================*\
| Lead Programmer/Owner===============Anti-Triangle Cult=====|
\*================================================*/
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th Dec 2008 23:02
http://www.cplusplus.com/reference/clibrary/ctime/ctime.html

Quote: "The string is followed by a new-line character ('\n') and the terminating null-character."


Put the resulting string into a string of your own, then chop off the newline before outputting it.

Login to post a reply

Server time is: 2024-09-30 13:33:05
Your offset time is: 2024-09-30 13:33:05