hide password input for both Windows and *Nix

I have written a program that just asks for a username and password to log in, and then executes a particular function depending on who logged in. It works but I can't figure out how to make the passwords not show(I really have but of course it's platform-dependent). I'm trying to figure out how I can compile either <conio.h> or <windows.h> with <termio.h> from linux. I have a function that determines the os based on the hostname global variable, so it can use the appropriate functions from either header as necessary. Is there a way to compile the windows headers with g++ on Linux?
Last edited on
I don't think that you can use Windows headers on Linux.
What you can try is to use the pre-processor.

1
2
3
4
5
6
7
#if defined(WINDOWS)
#include <windows.h>
//all other windows stuff
#elif defined(LINUX)
#include <termio.h>
// all other linux stuff
#endif 
O.K this compiled on linux. Linux is still not compiling the windows headers, though, is it?(I haven't had a chance to test on windows) I have a function that decides the OS and I can make onother to run functions from these headers based on the OS so the program will decide when to use windows stuff or linux stuff in the same function to hide the input. It has to be able to compile everythng. This is kind of my solution to the platform dependence issue.

EDIT: oh so this make the source cross-platform but the binary will only run on the system that compiled it? Not what I was hoping for but I guess it will work.

Last edited on
Topic archived. No new replies allowed.