Saturday 19 May 2018

windows - C++ executing DOS commands doesn't work

I want to run DOS commands in a C++ program but I don't know exactly how.
This is my code:



#include "stdafx.h"
#include
void main()
{
system("c:\wmic os get Version");
}



But this is what it shows:



1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
1>C:\Users\rares992\Documents\Visual Studio 2010\Projects\project_scs\Debug\project_scs.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.20

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


*I run it with Microsoft Visual Studio 2010.



Can anyone tell me what is wrong and what should I do? Thankyou.

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...