Catching ERROR_ALREADY_EXISTS and similar errors with CreateDirectory() [duplicate] - c++

This question already has answers here:
Create a directory if it doesn't exist
(10 answers)
Closed 6 years ago.
I am looking to make a program using CreateDirectory(), RemoveDirectory(), and similar functions. One of the possible return errors from these commands ERROR_ALREADY_EXISTS. I want an if statement to catch this error and post a message on the screen and continue.

You need to call GetLastError () and check to see if the error condition meets ERROR_ALREADY_EXISTS; after calling CreateDirectory() and when it returns 0.

Related

G++ is throwing an error on some basic inline asm [duplicate]

This question already has an answer here:
gcc, inline assembly - pushad/popad missing?
(1 answer)
Closed 6 years ago.
I'm trying to execute
asm("pushad"); yet it's throwing an error saying "invalid instruction mnemonic "pushad" and then shows the line. I couldn't find anything on google and it SHOULD work. I've also tried __pushad, _pushad and PUSHAD.
G++ uses the 16bit version, pusha

How can an empty for(;;) work? [duplicate]

This question already has answers here:
No loop condition in for and while loop
(5 answers)
Closed 7 years ago.
How does an empty for works?
I have seen this code (and works perfectly)
for(;;) {
And I can't comprehend how is this working or why
It is exactly like while(true).
It skips all the conditions so it just empty-executes since in for the expressions are all optional (i.e. you don't have to provide them if you choose not to).

Work with File in windows [duplicate]

This question already has answers here:
How can we check if a file Exists or not using Win32 program?
(9 answers)
C++: Which is the best method of checking for file existence on windows platform [duplicate]
(11 answers)
Closed 9 years ago.
I need a function in c++ to check if a given path/filename exists on the computer.
Can anyone help me?
This could be another possibilty besides the ones from the comments
PathFileExists

static_message or something like that [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Does there exist a static_warning?
Is there a way to implement non fatal messages at compile time just like static_assert do when its condition fail? Having a message that shows up always when the compiler encounters it is not enough, I want it to show up when, for example, a template is instantiated.
Would BOOST_STATIC_WARNING work for you?

What are WinMainCRTStartup, tmainCRTStartup, WinMain functions used for? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicates:
“APIENTRY _tWinMain” and “WINAPI WinMain” difference
What functions does _WinMainCRTStartup perform?
I just started to dive into windows programming. And when I tried to understand the win 32 program I noticed that the program has two entry points which are _tmainCRTStartup and _WinMainCRTStartup. Besides, I found the _tmainCRTStartup function also called _WinMain function. I just wonder what are they used for? And why there are two different entry points.
Thanks!