Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Hello World! - nothing works.
Message
Information générale
Forum:
Visual C++
Catégorie:
Autre
Divers
Thread ID:
00090585
Message ID:
00090968
Vues:
28
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform