Good afternoon, please tell me what am I doing wrong?

Here is the application code

#include "stdafx.h" #include <windows.h> #include <iostream> using namespace std; int main() { cout << "Content-Type: text/html\n\n"; cout << "<HTML><HEAD><TITLE>Some text</TITLE></HEAD>\n"; cout << "<body text='#F2F2F2' link='#FF9900' vlink='#FF9900' alink='#FF9900'>\n"; cout << "<meta http-equiv='content-type' content='text/html; charset=windows-1251'>\n"; cout << "<p style='line-height:100%; margin-left:10%;' align='center'><span style='font-size:14pt;'>Cgi-скрипт на С++.</span></p>\n"; char comment[256]; Triangle triangle; if(GetEnvironmentVariable(L"QUERY_STRING", (LPWSTR)comment,256)) { cout<<"<p style='line-height:100%; margin-left:10%;'>Вы ввели: "<<comment<<"</p>\n"; } system("pause"); return 0; } 

My algorithm of actions: 1. Created a simple C ++ application, compiled it, got an .exe file and replaced the extension with .cgi
2. I work with XAMPP Apache, I placed this file in C: \ xampp \ htdocs \
3. Next, I access this file via localhost {file name} .cgi

Problem: As a result of launching this file, for some reason, the cmd console opens and nothing happens as soon as I close the console in the browser it writes "Server error"

    1 answer 1

    That's what a bad habit to push system("pause") to the end? remove and most likely it will work (that's why the console opens)

    • Thank you very much, helped out)) - Nico_99