Can console commands like cin, cout, getch, etc be used in windows apps?

  • Comp Sci
  • Thread starter Pipsqueakalchemist
  • Start date
  • #1
Pipsqueakalchemist
130
18
Homework Statement
can I used console commands in windows application?
Relevant Equations
C++, visual studio
So I started working in a windows application. But i started having issues with blocking the event loop when using while loops that i never encountered before when using while loops in console application.

My theory is that I used commands like getch or cin to exit the loop in the window application and that those commands work fine in console but not in windows and that's why I can't exit my while loops and my event loop is blocked

Is this the case because if it's not then I'm at a complete loss because I've never encountered these issues before when coding in console.
 
Physics news on Phys.org
  • #2
You kind of let your other thread with this question just hang there.

But to repeat some from that thread: as a rule of thumb you cannot in general expect that blocking I/O and event driven applications mix well. Waiting for user input using cin in GUI application seems particularly weird and pointless since the GUI is there to handle user input with framework elements like buttons and text fields/areas. Perhaps you can describe what kind of problem you are trying to solve and what makes you want to mix console and GUI functions?

It will probably also be a good idea you learn the basics of (Windows) GUI programming and how to structure such an application to solve "standard problems".
 
  • Like
Likes Tom.G and Mark44

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
3
Views
567
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
10
Views
2K
  • Programming and Computer Science
Replies
2
Views
911
  • Engineering and Comp Sci Homework Help
Replies
6
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
8K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Computing and Technology
Replies
12
Views
2K
Back
Top