I have some code that was provided to me written in C that I'm using in a C++ project. I need to add some functionality, along with unit tests. Unfortunately it's hard coded to use getchar and other C IO functions in a way that isn't very easy to test.
What I'm trying to do is mock the C stdin. Is there some way to create a C++ stringstream and redirect C stdin to read from that?
I know how to do it with std::cin but not stdin.