I want to edit some .LAN files with Delphi 7. I can open them using notepad. My question is can i do the same using Delphi also? Or is there some in-built functions like TIniFile,TRegistry etc. which has inbuilt functions?
Ideas would be appreciated.
Thanks
If you can open a .LAN file in Notepad (and the content makes sense), it means that a .LAN file is just a plain-text file. And, of course, plain-text files can be easily opened in Delphi. Just open it the way you would open a ‘normal’ .TXT file (using
TStringList, for instance). It doesn’t matter that the extension is different, as long as it is a plain-text file.Now, I have no idea what a .LAN file contains. It most definitely is not a common file format, so I am pretty sure that the RTL/VCL has no parser for it.
However, if a .LAN file has the structure of an .INI file, then — of course — you can treat it like an .INI file and use the
TIniFile(or theTMemIniFile).One word of caution, however. You are using an old version of Delphi. Delphi 7 doesn’t support Unicode in its VCL, so if the .LAN files are Unicode, then you need to apply some trix when reading and writing it.
(If it is UTF-8 without a BOM, you might lose special characters, but that is it. If there is a BOM, just remove it. If the file is using two bytes per character, it will look strange to you e v e n i f i t d o e s n ‘ t c o n t a i n a n y s p e c i a l c h a r a c t e r s. In any case, some trix will do it for you.)
☂