SRL Archive - FAQ

A couple of function questions


omgnomorenames

2012-07-21 03:26:33

Just looking for a few functions
Double to String
and
Get System Time

Is
CreateFile ('StatusReport.txt');
the correct way to write this otherwise could you provide the correct way.
Lastly is FileNum for WriteFileString the line number?

Sex

2012-07-21 04:26:27

From: omgnomorenames
Just looking for a few functions
Double to String
and
Get System Time

Is
CreateFile ('StatusReport.txt');
the correct way to write this otherwise could you provide the correct way.
Lastly is FileNum for WriteFileString the line number?

IntToStr or ToStr should be able to convert a double to a string.

No, FileNum is an index for the internal file handles, it is used to specify which file "connection" you want to operate on. You would create a file like this
 FileNum := CreateFile('StatusReport.txt');
Then you can write to it
WriteFileString(FileNum, 'Hi' #13#10);

Daniel

2012-07-21 05:55:58

From: omgnomorenames
Just looking for a few functions
Double to String
and
Get System Time

Is
CreateFile ('StatusReport.txt');
the correct way to write this otherwise could you provide the correct way.
Lastly is FileNum for WriteFileString the line number?


  • Double to String
  • [Indent]Use the function FloatToStr to convert a Single, Double, Extended, or any other real type (incl. Currency) into a String.[/indent]
  • Get System Time
  • [Indent]The GetSystemTime function already included inside of Simba will get the current running time of your operating system in milliseconds (that is, the amount of uptime, or time since you turned your computer on). To get the current time and date, use the Now function. To convert this time and date into a string, you can do DateTimeToStr(Now). Alternatively, to convert the current time only (not including the date) into a string, use TimeToStr(Now), or for date only, use DateToStr(Now)[/indent]
  • CreateFile
  • [indent]You must specify the full path (see second introductory paragraph) to the file you want to create. This function returns a file handle (see my explanation for FileNum below, or Wikipedia).[/indent]
  • FileNum
  • [indent]This is the handle to your file. A handle is essentially a door number that will allow you inside. In this case, what is inside is your file that you want to add to. They save the need for constantly retyping the full path of the file, and add robustness to your program.[/indent]

Any more questions, please ask :)

Regards and good luck!
~ Daniel.

omgnomorenames

2012-07-21 17:01:29

Thanks Guys, one more quick question where is the source code for DecodeTime hidden?

Runaway

2012-07-21 17:24:51

From: omgnomorenames
Thanks Guys, one more quick question where is the source code for DecodeTime hidden?


Should be somewhere in here:

https://github.com/MerlijnWajer/Simba/tree/master/Units

omgnomorenames

2012-07-21 17:57:26

Yikes, worse than a library with no computer filing system.

Wizzup?

2012-07-21 19:46:46

DecodeTime is in Units/MMLAddon/PSInc/Wrappers/other.inc because it is actually a FreePascal function: http://www.freepascal.org/docs-html/rtl/sysutils/decodetime.html

masterBB

2012-07-21 19:56:22

DecodeTime is just a Delphi procedure:

https://github.com/MerlijnWajer/Simba/blob/master/Units/PascalScript/uPSC_dateutils.pas

omgnomorenames

2012-07-21 20:55:27

Thanks guys