Save ini as LF not CRLF?

Just starting out? Need help? Post your questions and find answers here.
stmdbe2019
User
User
Posts: 89
Joined: Mon Aug 31, 2009 2:11 pm

Save ini as LF not CRLF?

Post by stmdbe2019 »

How to tell PureBasic to keep the .ini file as original "LF" not by adding "CRLF". which is causing the C++ application to crash.

Screenshot: original file contain LF not CRLF (Purebasic adding CRLF while editing)
Image

Code: Select all

OpenPreferences("basic.ini")
  PreferenceGroup("SimpleOutput")
    WritePreferenceString("RecFormat", "mov")      
  ClosePreferences() 
ClosePreferences()
-----
Registered PureBasic Coder.
Bitblazer
Enthusiast
Enthusiast
Posts: 736
Joined: Mon Apr 10, 2017 6:17 pm
Location: Germany
Contact:

Re: Save ini as LF not CRLF?

Post by Bitblazer »

I honestly hope you do a bug report for the c++ application that crashes.

It's always good to go around problems but thats really a poor bug on the applications side. While waiting for changes, a simple option to continue work while you wait for the PB/application changes, would be to post-process the INI file and simply remove all CR codes or simply replace the preference functions with custom (binary writing) ones.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4663
Joined: Sun Apr 12, 2009 6:27 am

Re: Save ini as LF not CRLF?

Post by RASHAD »

Workaround

Code: Select all

OpenFile(0,"c:\mrplayer\settings\MRDefault.ini") ;Change to your file
  Text$ = ReadString(0, #PB_File_IgnoreEOL,-1)
CloseFile(0)
text$ = ReplaceString(text$,#CRLF$,#LF$)
OpenFile(0,"c:\mrplayer\settings\MRDefault2.ini")
  WriteString(0, Text$)
CloseFile(0)
Egypt my love
Post Reply