i need a correction about main function

heres the cmd main:
int main (int argc, char **argv)

heres the windows main:
1
2
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, 
    LPSTR lpCmdLine, int nCmdShow)


can i use the cmd main instead windows main?
(what i mean is that my main function must be compatible with cmd and windows)
Last edited on
Don't see why not. If you include windows.h you'll be able to call any Windows specific functions. However, you'll need to link with the appropriate libraries, for example, gdi, comdlg, commctl, etc. When you use an IDE and specify the project type, i.e., console or graphics, the IDE sets up the linkages. If you do what you described, you'll have to do it manually.

I know I've done this in PowerBASIC. Sometimes I forget which programming language I'm using at the moment. Many times in graphics ewnvironments I open a console screen for debug output.
thank you so much for all.. thank you
Topic archived. No new replies allowed.