using wxConfigFile 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
Qasim
Knows some wx things
Knows some wx things
Posts: 29
Joined: Wed May 23, 2007 3:41 pm
Location: London

using wxConfigFile

Post by Qasim »

Hi. Iam using wxConfigFile to save application settings. But every time the "MyApp.ini" file is created in C:\Documents and Settings\CURRENT_USER directory.
Is there any way to change its location, something like in "C:\Settings" etc.

I am doing some thing like this (please ignore syntax Errors, if any)

Code: Select all

wxConfigFile* writer= new wxConfigFile("MyApp, Vendor");
writer->SetPath("Mainframe/size")
writer->Write("width",800);
writer->Write("Height",600);
writer->Flush();
delete writer;
Any help will be appreciated.
Cheers
Who doubts nothing, Knows nothing
JudyL
Experienced Solver
Experienced Solver
Posts: 66
Joined: Tue Jul 24, 2007 2:20 pm
Location: Florida, USA

Post by JudyL »

wxFileConfig varFile (wxEmptyString, wxEmptyString, wxEmptyString, "c:\absolutepath\filename", wxCONFIG_USE_GLOBAL_FILE);

Judy
lester
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 211
Joined: Sat Sep 02, 2006 7:24 pm
Location: Ukraine

Post by lester »

Code: Select all

  // ctor & dtor
    // New constructor: one size fits all. Specify wxCONFIG_USE_LOCAL_FILE or
    // wxCONFIG_USE_GLOBAL_FILE to say which files should be used.
  wxFileConfig(const wxString& appName = wxEmptyString,
               const wxString& vendorName = wxEmptyString,
               const wxString& localFilename = wxEmptyString,
               const wxString& globalFilename = wxEmptyString,
               long style = wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_GLOBAL_FILE,
               const wxMBConv& conv = wxConvAuto());
lester
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 211
Joined: Sat Sep 02, 2006 7:24 pm
Location: Ukraine

Post by lester »

Code: Select all

  wxFileConfig(wxInputStream &inStream, const wxMBConv& conv = wxConvAuto());
may be also useful
mc2r
wxWorld Domination!
wxWorld Domination!
Posts: 1195
Joined: Thu Feb 22, 2007 4:47 pm
Location: Denver, Co
Contact:

Post by mc2r »

Hmmm, I bet all of those could be found in the docs?

-Max
JudyL
Experienced Solver
Experienced Solver
Posts: 66
Joined: Tue Jul 24, 2007 2:20 pm
Location: Florida, USA

Post by JudyL »

mc2r wrote:Hmmm, I bet all of those could be found in the docs?

-Max
Of course :) I was bored waiting for a compile to finish - bored enough to cut and paste a line from my source code but not bored enough to look up the ctor in the documents
mc2r
wxWorld Domination!
wxWorld Domination!
Posts: 1195
Joined: Thu Feb 22, 2007 4:47 pm
Location: Denver, Co
Contact:

Post by mc2r »

JudyL wrote:
mc2r wrote:Hmmm, I bet all of those could be found in the docs?

-Max
Of course :) I was bored waiting for a compile to finish - bored enough to cut and paste a line from my source code but not bored enough to look up the ctor in the documents
Judy, I think I wasn't clear enough on where the derision was aimed. It was aimed at the OP to be clear ;) Of course if the OP had bothered to look at the docs for the class being questioned then none of us would have had an outlet for our boredom.

-Max
Sof_T
Can't get richer than this
Can't get richer than this
Posts: 864
Joined: Thu Jul 28, 2005 9:48 pm
Location: New Forest, United Kingdom
Contact:

Post by Sof_T »

Judy, I think I wasn't clear enough on where the derision was aimed. It was aimed at the OP to be clear Of course if the OP had bothered to look at the docs for the class being questioned then none of us would have had an outlet for our boredom.
Actually the form of ctor in question is not mentioned in the documentation for wxConfigFile but in the base class wxConfigBase. The documentation for wxConfigFile only shows one form of constructor, so at first glance it is missable, I know I made the same mistake once. :D
The home of Sof.T http://www.sof-t.site88.net/
Author of Programming with wxDevC++
http://sourceforge.net/projects/wxdevcpp-book/
JudyL
Experienced Solver
Experienced Solver
Posts: 66
Joined: Tue Jul 24, 2007 2:20 pm
Location: Florida, USA

Post by JudyL »

Judy, I think I wasn't clear enough on where the derision was aimed. It was aimed at the OP to be clear ;) Of course if the OP had bothered to look at the docs for the class being questioned then none of us would have had an outlet for our boredom.-Max
Rest easy, I knew what you meant. I was still bored (it's a 30 minute compile! :D ) so I responded.
Post Reply