简体   繁体   中英

Print the output of a C++ program in internal console in Visual Studio, instead of default external cmd window

I tried the solution suggested in the question Having the output of a console application in Visual Studio instead of the console , but none of them are working. Please help.

I suggest you read this issue carefully.

About how to use OutputDebugString() I wrote a sample for your reference.

int main()
{

    char buffer[100];
    sprintf_s(buffer, "check it out: %s\n", "this is a sample");
    OutputDebugStringA(buffer);
    return 0;

}

Result:

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM