I was wondering how do you fin the current directory that your program is running from? I know in a console app you can get that out of argv[], i looked at the command line info that WinMain passes in lpCmdLine and it was blank.
I was wondering how do you fin the current directory that your program is running from? I know in a console app you can get that out of argv[], i looked at the command line info that WinMain passes in lpCmdLine and it was blank.
Look into GetCurrentDirectory().
"Optimal decisions, once made, do not need to be changed." - Robert Sedgewick, Algorithms in C
Try:
char * args = GetCommandLine();
Unfortunately, Windows forces you to parse it yourself (typical )!
Also, there's the good ole getcwd():
Code:char buff[100]; char dir[100]; getcwd(buff, 100); sprintf(dir, "Currently in %s", buff); MessageBox(NULL, dir, "Directory:", MB_OK);
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
Ok thanks but i had just found _getcwd(char*, int); Is that just visual C specific?
It should work fine. BTW, GetCurrentDirectory() works identically, but with reversed parameters.
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }