wxFileConfig and Flush() Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
chris
I live to help wx-kind
I live to help wx-kind
Posts: 150
Joined: Fri Oct 08, 2004 2:05 pm
Location: Europe

wxFileConfig and Flush()

Post by chris » Mon Feb 13, 2006 3:14 pm

Hi all,

I'm having some troubles with wxFileConfig not writing to the user data file when calling Flush(). I'm doing a

Code: Select all

long m_foo=42;
[...]
wxConfigBase::Get()->Write(_T("foo"),m_foo);
wxConfigBase::Get()->Flush();
but the value of "foo" isn't written until I call the dtor on the config object via

Code: Select all

delete wxConfigBase::Set((wxConfigBase *)NULL);
Note that this happens under Linux, where a file is the default way to store config stuff. It works fine under Windows and the registry.

Am I running into problems with the OS harddisk caches or something?
A quick glance over the source of fileconf.cpp didn't show any apparent problems; the dtor for wxFileConfig simply calls Flush() just like I do, so I suspect it has to do something with not closing the file handle leading to not writing the values.

TIA, Chris
this->signature=NULL;

DavidHart
Site Admin
Site Admin
Posts: 4045
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Post by DavidHart » Mon Feb 13, 2006 7:55 pm

Hi Chris,

I use wxGTK-2.6.2 (and earlier) on SuSE 9.3 (and others). I use Flush() all the time, and it behaves just as it should.

That is true also on 2 different machines, but perhaps your hardware setup may be the cause of the problem. I suppose you could try mounting sync.

Regards,

David

chris
I live to help wx-kind
I live to help wx-kind
Posts: 150
Joined: Fri Oct 08, 2004 2:05 pm
Location: Europe

Post by chris » Wed Feb 15, 2006 10:47 am

Hi David,

At first, thanks for your suggestions!

Now to the embarrassing part:

I forgot to update the source code from SVN on the Linux machine; the older version missed the calls to Flush(), but I blindly assumed I'd be working on the Head. :oops:

I'm going to sit in the corner now.

Thanks again,

Chris
this->signature=NULL;

Post Reply