hi !
i have a Data folder contain 2 file and some folders
how can i copy this folder ?
os:windows7...
hi !
i have a Data folder contain 2 file and some folders
how can i copy this folder ?
os:windows7...
Well a crude way would be to call system() to invoke the xcopy utility.
Or maybe something based on this
CopyFile function (Windows)
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
does system() have any command to remove non empty directory?
system() is just a programmatic way of doing whatever you could do at a console command prompt.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
It depends on how much effort you're willing to put into solving the problem.
Sooner or later, API bloat stops and you have to start doing some things for yourself.
For example, you could read this
FAQ > Accessing a directory and all the files within it - Cprogramming.com
Throw in some
CreateDirectory function (Windows)
Add a liberal sprinkling of
CopyFile function (Windows)
Perhaps some
DeleteFile function (Windows)
and
MoveFile function (Windows)
for good measure.
You should do some reading to find out how compressed and/or encrypted files are dealt with as well.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
tnx salem and elysia
i changed the win32 code(last example) and it seems to work and ofcource i dont know how!
FAQ > Accessing a directory and all the files within it - Cprogramming.com
would you recomend me a book for learning win32 ?
tnx
I would strongly suggest you go as far as you can with boost rather than going the Win32 route. Win32 is Evil™.
And if you want to do graphical user interfaces, you should pick up a GUI framework, such as Qt.
Avoid Win32 like the plague. It's convoluted, bloated and just extremely difficult to use. Plus it's C, and not C++, which strongly limits your effectiveness when using C++.
Well yes, but I mentioned the effectiveness. It limits our ability to express powerful and flexible code as we typically do in C++.
For example, for every resource we acquire, we must create some code to release that resource, be that some smart pointer + custom deleter or some new RAII object we write.
Or for example, for every callback, we are required to use a global or a static class member function which typically take some weird callback types which we have to cast back to proper types. We can't send a class member, some arbitrary function or functor or a lambda, all with correct parameter types for what we know the callback will receive.
I mean, it's like, if you are screwing screws and have an automatic screwdriver that works with those screws, why would you want to use a manual screwdriver, then? There is typically little point to "leaving" our rich and powerful universe unless we have a good reason for doing so.
In our "rich and powerful universe" we have to use third party libraries or APIs like boost, win32, or Qt to do little things like building a GUI, doing more than basic file handling, accessing databases, and a whole lot of things that are useful.
Win32, except for religious fanatics who intone that "Microsoft is evil" or "Win32 is evil" , is an option, no more. Like all of them, it has advantages and disadvantages.
I'm all in favour of doing things in standard C++ if at all possible, and am delighted that C++-11 offers more facilities and supports more techniques than previous versions of C++. But pragmatism is concerned with solving problems, not crouching in some some perceived state of perfection within some "rich and powerful universe". Not even the greats of C++ would advocate such crouching - they are mostly interested in how to get jobs done.
Incidentally, given that Microsoft is predominantly a C++ house, your characterising win32 as C is ironic. The C-like flavour of the win32 API is more about allowing it to be used across programming languages, rather than a homage to C.
I would argue that, unless there is something you cannot express in whatever language you are using and whatever libraries, frameworks and tools you are using, and you can express it in Win32, you should not use Win32.
On a purely opinion way, it is ugly as hell, a pain to work with and is just disgusting, being built on old and dull foundations (as opposed to "syntax rich" foundations), and on a practical note, it is much easier to shoot yourself in the foot and it just takes more time to get the job done.
That is, at least for a newbie.