这是由于cout的缓存造成了,有两种办法
第一、强制缓存输出
std::cout << "test" << std::flush; // std::flush is in <iostream>第二种、不缓存
或
std::cout << "test";
std::cout.flush(); // explicitly flush here
或
std::cout << "test" << std::endl; // endl sends newline char(s) and then flushes
std::setvbuf(stdout, NULL, _IONBF, 0);或运行c++程序的时候加入以下参数
stdbuf -o 0 ./yourprogram --yourargs
网友回复
win10如何修改机器码?
python结合ffmpeg如何实现窗口实现视频格式转换压缩、分离音频,合并字幕及音频?
Pogocache比redis更快更好用?
新手如何使用yolo进行图像数据标注与图像识别?
threejs如何将glb三维模型减少面数和定点数粗糙一些减少文件体积大小?
在哪可以免费下载各国的武器飞机坦克航母舰艇导弹三维模型glb文件?
aistudio中build如何破解gemini的api模型调用免费使用?
python如何让红绿灯看懂两侧车流智能调节红绿灯?
python+faster_whisper如何实现实时开会录音并转成文字?
python如何调用微信本地的ocr进行图片文字提取?