Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Hello World! - nothing works.
Message
From
09/04/1998 22:15:37
 
General information
Forum:
Visual C++
Category:
Other
Miscellaneous
Thread ID:
00090585
Message ID:
00090968
Views:
27
If you want to use plain C language, you should choose "Win32 console application" type of project.

Besides that, "winmain" must be "WinMain". As you know, C is case sensitive. Also, the prototype for WinMain does not accept void as parameters.

Another mistake in your code is the string "c:\test". The backslesh is reserved character inside character strings. If you want to have one backslesh, than you have to use "\\". So, your string becomes: "c:\\test".

Here's the code that works if you start with Win32 console app projects:
#include <windows.h>

 void main(void)
 {
 int nTemp;
 nTemp=MessageBox(NULL,"Hello World",NULL,MB_OK);
 }

 ------

 #include <windows.h>
 #include <stdio.h>

 void main(void)
 {
 FILE *filehandle;

 filehandle=fopen("c:\\test.txt","w");
 fprintf(filehandle,"%s\n","Hello World");
 fclose(filehandle);
 }
Vlad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform