How do i create a file 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
Ste2008
Knows some wx things
Knows some wx things
Posts: 47
Joined: Mon Mar 10, 2008 11:18 am
Location: Ireland

How do i create a file

Post by Ste2008 »

Hi all,
sorry for stupid question looking to create a file to write to, and am using wxFile but cant gat it to work what am i doing wrong

wxFile::Create(SaveDialog->GetFilename(), true,wxS_DEFAULT);

Thanx in advance
Ste2008
Knows some wx things
Knows some wx things
Posts: 47
Joined: Mon Mar 10, 2008 11:18 am
Location: Ireland

Post by Ste2008 »

This is the error I get

Code: Select all

cannot call member function `bool wxFile::Create(const wxChar*, bool, int)' without object
I dont understand what it means by adding an object, as I just want the function to create a file[/quote]
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria »

This is not a function, it's a member method of an object
You need to instanciate a wxFile object first.

I think you need to learn C++
gawi
Knows some wx things
Knows some wx things
Posts: 49
Joined: Sun Mar 16, 2008 8:30 am
Location: Poland

Post by gawi »

Auria is right :]

Try :

Code: Select all

wxFile file;
file.Create(SaveDialog->GetFilename(), true,wxS_DEFAULT);
Post Reply