question

Hoang Nk avatar image
0 Likes"
Hoang Nk asked Hoang Nk commented

Troubles when using the realtime() command

Hi guys,

I'm having a small question regarding the realtime() command.

So I'm writing a logging function for my model and would like to write the information such as time and date, actions and results, etc. into a text file. I got it worked but there is a small problem when printing date/time using the realtime() command as it automatically returns a new line right after the date/time. For example I would like to print some strings like this:

"Fri May 5 08:30:48 2023 SocketClient Level5 test test test"

However, using the realtime() command will return this:

"Fri May 5 08:30:48 2023

SocketClient Level5 test test test"

where you can see that it makes 2 lines instead of writing in the same line.

Does anyone have any idea how to fix this?

Regards,

Hoang

FlexSim 23.1.0
realtime
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Felix Möhlmann avatar image
2 Likes"
Felix Möhlmann answered Hoang Nk commented

Using trim() on the returned string seems to do it.

capture1.png


capture1.png (8.1 KiB)
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Hoang Nk avatar image Hoang Nk commented ·
Thanks, I'll try it


0 Likes 0 ·