News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

*.INI files

Started by jj2007, June 10, 2022, 10:11:19 AM

Previous topic - Next topic

jj2007

include \masm32\MasmBasic\MasmBasic.inc
  Init
  .if !Ini$()                           ; no ini file found, let's create one
        SetIni$ "crtDate", fDate$()
        SetIni$ "crtTime", fTime$()
  .endif
  PrintLine "Created  ", Ini$("crtDate"), ", ", Ini$("crtTime")
  SetIni$ "modTime", Cat$(fDate$()+", "+fTime$())
  PrintLine "Modified ",  Ini$("modTime")
EndOfCode


Output (12 minutes later):
Created  10.06.2022, 01:56:41
Modified 10.06.2022, 02:09:00


Building the attached source requires MasmBasic of 10 June 2022

P.S.: This is meant for settings, i.e. short names and values in the format name=value. There is a limit of 100 kBytes. Names and values can be Unicode, encoded as Utf8 (i.e. Chinese or Russian are not a problem, see below).

Be careful with embedded CrLf - not impossible, but you need a workaround with Replace$():
  Let edi=FileRead$("\Masm32\menus.ini") ; qEditor's menus
  SetIni$ "меню редактора", Replace$(edi, CrLf$, "[CrLf$]")
  PrintLine cfm$("\nqEditor menus:\n"),  Replace$(Left$(Ini$("меню редактора"), 200), "[CrLf$]", CrLf$), "..."