Re: Reading a path value in an "ini" file

Igor Korot <[email protected]>
Newsgroups gmane.comp.lib.wxwindows.general
Message-ID <CA+FnnTy5JuborN4QGQ04FhxT1oZ1RjcHaPib7wyT_ejbF+HFbw@mail.gmail.com>
Xaviou,

On Tue, Oct 1, 2024 at 12:02 PM Xaviou <[email protected]> wrote:
>
> Hi.
> As said in the title, I have to read some values in an ini file created by another app.
> Here is the corresponding part of the code (simplified):
>
> wxFileInputStream f_in(_T("Path to the ini file"));
> wxFileConfig datas(f_in);
> datas.SetPath(_T("/Settings"));
> wxString sValue  = datas.Read(_T("KeyName"));
> ......
>

As you already have the wxConfig - why are you not using its API?

Thank you.

> All works fine until the value of the corresponding key contains backslashes (for example the fullpath to a last used file).
> In this last case, the backslashes are treated as escape chars, and they are removed (their following chars are also removed).
> For example, reading the following:
> [Settings]
> KeyName=C:\Users\Xavier\Desktop\TestFile.txt
> will give:
> C:sersavieresktopestFile.txt
> As you can guess, I'm working on Windows.
> I tried doing trhe same thing in pure Win32 code (using GetPrivateProfileString), and it works correctly.
>
> As the ini file is not very big, I can read it manually, line by line, but I would prefer using the wxWidgets built-in classes if it was possible.
>
> Is there something I am doing wrong ?
>
> Regards
> Xav'
>
> --
> Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
> ---
> You received this message because you are subscribed to the Google Groups "wx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/cf0c0782-ea37-4cbf-b71a-4555c1f8e0d6n%40googlegroups.com.

-- 
Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
--- 
You received this message because you are subscribed to the Google Groups "wx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/CA%2BFnnTy5JuborN4QGQ04FhxT1oZ1RjcHaPib7wyT_ejbF%2BHFbw%40mail.gmail.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.