![](/uploads/1/2/5/7/125755740/738410094.jpg)
Microsoft Visual C (often abbreviated to MSVC) is an integrated development environment (IDE) product from Microsoft for the C, C, and C/CLI programming languages.MSVC is proprietary software; it was originally a standalone product but later became a part of Visual Studio and made available in both trialware and freeware forms. It features tools for developing and debugging C code.
Use Visual Studio 2019 to target Windows, Linux, Android, and iOS to create apps, games, and more, taking advantage of market-leading debugging and productivity tools to get work done quickly.
CMake, Clang, mingw, and more
Open a codebase from any environment and get to work right away. Use MSBuild with the Microsoft Visual C++ compiler or a 3rd party toolset like CMake with Clang or mingw to build and debug your code right in the IDE. Benefit from a first-class CMake experience.
The best way to target Windows
Design and build classic Windows desktop programs or Universal Windows apps targeting HoloLens, Surface Hub, PC, and Xbox with the Microsoft Visual C++ toolset and the Visual Studio 2019.
Build apps using C++11, C++14, and C++17
Enjoy support for C++11, C++14 and many C++17 features with market leading performance, build throughput and security. Write code using the power of generic lambda expressions, resumable functions, decltype (auto), extended constexpr and C++ attributes, fold expressions, noexcept in type system, inline variables and other modern features.
Write Linux apps and debug them in real-time
Take advantage of powerful coding and debugging tools to manage code targeting Linux built with GCC, Clang, or another compiler. Debug your Linux applications as they run remotely with GDB. Whether you are building IoT apps or high-performance computing cloud services for Linux, Visual Studio will help you be productive.
Target Android and iOS while staying productive
Leverage the power of Visual Studio 2019 and the debugger to build high-performance Android and/or iOS apps and games in C++, share C++ libraries to target both mobile platforms and Windows, or write once and run across all mobile platforms with Xamarin and C++.
Join the many AAA top game studios already using Visual Studio
Create high-performance games with DirectX to run on Windows devices, or build cross-platform games with a top game engine, such as Unity, Unreal, and Cocos. Join the many wildly-successful game studios that already use Visual Studio to boost your productivity with Visual Studio 2019 and the world-class debugger.
Write the best, bug-free code
Do all the basics like setting breakpoints and stepping through your code, then get more advanced with variable visualization, performance profiling, debugging any local or remote process, and multi-threaded application debugging. Run to click, edit your live code and continue executing without having to rebuild.
Browse, edit, and improve your code quickly
Visualize your code with syntax colorization, guidelines, code tooltips, Class View, or Call Hierarchy. Navigate to any code symbol by reference, definition, declaration, and more. Autocomplete your code as you type, quickly repair problems, and refactor your code to your needs. Analyze your code for common issues. Save time that could be better spent.
Free, fully-featured IDE for students, open-source and individual
developers
developers
Professional developer tools, services, and subscription benefits for small
teams
teams
End-to-end solution to meet demanding quality and scale needs of teams of all
sizes
sizes
How does one 'pause' a program in C++ on Win 32, and what libraries must be included?
T.E.D.36.7k77 gold badges5959 silver badges128128 bronze badges
Chris_45Chris_453,5711515 gold badges5050 silver badges7171 bronze badges
7 Answers
Or if you want to pause your program while waiting for another program, use WaitForSingleObject.
IVladIVlad37.6k1111 gold badges8888 silver badges164164 bronze badges
If you are using boost, you can use the
thread::sleep
function:Otherwise, you are going to have to use the win32 api:
And, apparently, C++0x includes this:
John Gietzen![Fungsi microsoft visual c++ 2012 Fungsi microsoft visual c++ 2012](/uploads/1/2/5/7/125755740/487646091.png)
39.2k2828 gold badges130130 silver badges181181 bronze badges
In C++11, you can do this with standard library facilities:
Yochai TimmerYochai Timmer35.6k2020 gold badges118118 silver badges166166 bronze badges
If you wish for the program to stay responsive while 'paused', you need to use a timer event.
TronicTronic8,79111 gold badge3434 silver badges4848 bronze badges
Please note that the code above was tested on Code::Blocks 12.11 and Visual Studio 2012
on Windows 7.
on Windows 7.
For forcing your programme stop or wait, you have several options :
- sleep(unsigned int)
The value has to be a positive integer in millisecond.That means that if you want your programme wait for 2 second, enter 2000.
Here's an example :
If you wait too long, that probably means the parameter is in second. So change it like that :
For those who get error message or problem using sleep try to replace it by _sleep or Sleep especially on Code::Bloks.
And if you still getting probleme, try to add of one this library on the biggining of the code.
And if you still getting probleme, try to add of one this library on the biggining of the code.
- system('PAUSE')
A simple 'Hello world' programme on windows console application would probably close before you can see anything. That the case where you can use system('Pause').
If you get the message 'error: 'system' was not declared in this scope' just add the following line at the biggining of the code :
- cin.ignore()
The same result can be reached by using cin.ignore() :
- cin.get()
example :
- getch()
Just don't forget to add the library conio.h :
You can have message telling you to use _getch() insted of getch
borderlessborderless
It depends on what type of program you are writing.
A console app can just call Sleep. A GUI app probably does not want to do this, as all the menus and widgets will go insensitive, and the app won't redraw itself during this period. Instead you need to do something like set yourself up a timer with a callback when it expires.
T.E.D.T.E.D.36.7k77 gold badges5959 silver badges128128 bronze badges
Dont use a sleep function in your GUI if it is not provided by the framework you are working with. This could create referencing problems to data (specially in a thread that is not the main thread). This could freeze you GUI. Its not just a question of sleeping for a short time , use waitmutexes if you need to do that.
yan bellavanceyan bellavance2,3551818 gold badges5252 silver badges7878 bronze badges
Not the answer you're looking for? Browse other questions tagged c++sleep or ask your own question.
![](/uploads/1/2/5/7/125755740/738410094.jpg)