Naresh T
Naresh T

Reputation: 319

How to create an error so that GetLastError returns the error?

I've a function to convert GetLastError function to string to use in my project. But before deploying, I need to test in a sample program. When I test it, it gets me no error, because the sample program doesn't have any error.

Can anyone help me how can I generate a couple of errors in std::errc, so that GetLastError throw them?

Upvotes: 0

Views: 138

Answers (1)

ovk
ovk

Reputation: 2358

Call SetLastError() from the same thread with desired error code.

Take a look on the SetLastError documentation here

Upvotes: 1

Related Questions