I'm new to developing apps on Windows 10 IoT, so I made little test application just to test how to read input from stdin on a console app on a Raspberry Pi 2 running Windows 10. Now I know that this is not the average use case, but my original app has the purpose to only serve as a demo.
My little code in C++ (for reasons I'm restricted to C++) so far is very simple:
#include "pch.h"
int main(int argc, char **argv) {
char buffer[1024];
std::cin.getline(buffer, 1024);
printf("%s \n", buffer);
}
The problem I face is, that the line
std::cin.getline(buffer, 1024);
seems to be omitted. All the program does is printing an empty line. So there isn't even time to type anything to stdin. Maybe it's worth mentioning that I'm testing this via a powershell remote session so maybe this has anything to do with it.
My questions are now:
- Is it even possible to read a line from stdin? (I guess so)
- Am I doing it wright? (Certainly not)
- What is the correct/clean way to do so? Where is my error?