i was wondering if there is any way to get the username in a c++ script, i need it to be working on windows and on linux.
in this moment im doing it like this:
#include <iostream>
#include <unistd.h>
int getlogin_r(char *buf, size_t bufsize);
cout << getlogin()<< endl;
but of course it runs only in linux i thought about doing this using a function that works in both windows and linux or in some way switching the function based on the system.