Search found 17 matches

by mathieumg
Wed Aug 25, 2010 2:30 pm
Forum: C++ Development
Topic: Directory recursivity - Delete/copy/move a whole tree
Replies: 7
Views: 1764

I finally got things to work! The code is far from optimal/proper, but it does the job for now based on my needs! Here is the code if anyone ends up on this page after a search and needs a starting point! bool copyTree( wxFileName* source, wxFileName* destination ) { // Copy file if it isn't a direc...
by mathieumg
Wed Aug 25, 2010 11:47 am
Forum: C++ Development
Topic: Directory recursivity - Delete/copy/move a whole tree
Replies: 7
Views: 1764

David/Auria, as we discussed on IRC yesterday, I still have problems making this work :( If I put a breakpoint at the beginning of the function and follow it line-by-line, it will always go in the else instruction of the DirExists condition. When I do that, I also see that copyTree gets called infin...
by mathieumg
Tue Aug 24, 2010 6:56 pm
Forum: C++ Development
Topic: Directory recursivity - Delete/copy/move a whole tree
Replies: 7
Views: 1764

The logging says it couldn't copy "C:\test\1" to "C:\testdump\1" with an access denied error. It sounds like it thinks that 1 is a file (while it actually is a directory). Could it be that source->IsDir() doesn't work well? David said on IRC that it could be related to using forward slashes instead ...
by mathieumg
Tue Aug 24, 2010 3:29 pm
Forum: C++ Development
Topic: Directory recursivity - Delete/copy/move a whole tree
Replies: 7
Views: 1764

Thanks for the help David! Here is what I tried to come up with for the copy version: bool copyTree( wxFileName* source, wxFileName* destination ) { // Copy file if it isn't a directory. if ( ! source->IsDir() ) { if ( ! wxCopyFile(source->GetFullPath(), destination->GetPath(wxPATH_GET_VOLUME | wxPA...
by mathieumg
Mon Aug 23, 2010 1:32 pm
Forum: C++ Development
Topic: Directory recursivity - Delete/copy/move a whole tree
Replies: 7
Views: 1764

Directory recursivity - Delete/copy/move a whole tree

Hi, I'm looking to delete a whole directory (including all it's subdirectories and files), though I might need to do copy/move operations in the same manner. I'm using 2.8, and I was told that wxRmdir isn't recursive under this version, in other words the directory to remove needs to be empty. So I'...
by mathieumg
Fri Aug 20, 2010 12:49 pm
Forum: C++ Development
Topic: Output wxInputStream in console
Replies: 9
Views: 1515

Thanks for the information David!
by mathieumg
Thu Aug 19, 2010 11:34 am
Forum: C++ Development
Topic: Output wxInputStream in console
Replies: 9
Views: 1515

Sorry for double posting, you can merge my posts if needed. I got it to work with the SYNC execution this way: wxArrayString output, errors; size_t count; wxExecute(wxT("psgetsid.exe Administrator"), output, errors); count = output.GetCount(); for ( size_t n = 0; n < count; n++ ) { cout << output[n]...
by mathieumg
Thu Aug 19, 2010 11:15 am
Forum: C++ Development
Topic: Output wxInputStream in console
Replies: 9
Views: 1515

Just compiled the exec sample and it works perfectly D:

Even weirder, when I try to redirect with SYNC on in my program, it complains whereas the exec sample allows me to choose between SYNC and ASYNC and both work perfectly :(
by mathieumg
Wed Aug 18, 2010 7:40 pm
Forum: C++ Development
Topic: Output wxInputStream in console
Replies: 9
Views: 1515

Thanks for the info Auria! I have tried different things but I seem to be regressing. The following code: wxProcess externalProcess; wxInputStream *consoleOutput; externalProcess.Redirect(); externalProcess.Open(wxT("ipconfig.exe")); consoleOutput = externalProcess.GetInputStream(); cout << external...
by mathieumg
Wed Aug 18, 2010 1:27 pm
Forum: C++ Development
Topic: Output wxInputStream in console
Replies: 9
Views: 1515

Code::Blocks doesn't come with a debugger (afaik), do you have a good suggestion? Also, I've tried to dumb down the code as much as possible but it still crashes: wxProcess externalProcess; wxInputStream *consoleOutput; wxChar buffer[4096]; externalProcess.Redirect(); externalProcess.Open(wxT("cmd")...
by mathieumg
Wed Aug 18, 2010 12:10 pm
Forum: C++ Development
Topic: Output wxInputStream in console
Replies: 9
Views: 1515

Output wxInputStream in console

The following code runs ok: wxProcess externalProcess; wxInputStream *consoleOutput; externalProcess.Redirect(); externalProcess.Open(wxT("psgetsid.exe Administrator"), wxEXEC_ASYNC); consoleOutput = externalProcess.GetInputStream(); But when I try to read the program output with the following code ...
by mathieumg
Mon Aug 09, 2010 6:49 pm
Forum: C++ Development
Topic: WxString conversion question.
Replies: 13
Views: 1946

http://wiki.wxwidgets.org/Converting_ev ... o_wxString ?

Edit: Oops, it was already pointed out. However, if by "char block" you mean char array, well that's what char * is.
by mathieumg
Mon Aug 09, 2010 12:03 pm
Forum: C++ Development
Topic: Accents in the console on Windows using unicode build
Replies: 4
Views: 863

Re: Accents in the console on Windows using unicode build

I've tried the different solutions linked, and so far I've only been able to get one to work: using namespace std; #include <string> #include <iostream> #include "wx/string.h" #include "wx/app.h" int main(int argc, char **argv) { wxInitialize(); UINT oldcp = GetConsoleOutputCP(); SetConsoleOutputCP(...
by mathieumg
Fri Aug 06, 2010 9:26 pm
Forum: C++ Development
Topic: Accents in the console on Windows using unicode build
Replies: 4
Views: 863

Accents in the console on Windows using unicode build

I thought this would help, but it didn't: http://forums.wxwidgets.org/viewtopic.php?t=19525 I'm trying to output words with accents in the console on Windows, I've searched a lot but haven't found a solution for wxWidgets. Here is my code: using namespace std; #include <string> #include <iostream> #...
by mathieumg
Fri Aug 06, 2010 6:52 pm
Forum: C++ Development
Topic: Beginner question about wxMemoryBuffer
Replies: 4
Views: 923

Thanks a lot doublemax!

I just read your link and it has taught me a lot, I had done manual bit manipulation in my circuits course but had never seen the C/C++ side of it.