I simply have an ascci art that I show with different printfs and I want to put in the middle the name of the user. (with the name I mean the windows user).
I thought about taking out the name with a System ("whoami"), which works for me but because I can not store it in a variable I can not format it and when I put the system and the command to peel, automatically after put the user prints a line break.
If someone has any idea how to manipulate it or how to take out the username in a different way would be very helpful.
Summing up specifications:
Language C. (Only C not c ++ or anything like that)
Operating system (Windows)
Specific problem: The problem occurs when I try to print the user name on the screen in the middle of many characters, and with the System ("Whoami") it prints the name but makes an automatic line jump after the name.
Possible solutions thought: Clearly I do not have a solution but I thought of some way of being able to store this with something similar to a System () in a variable since with the system you can not or some way of formatting it to establish that it does not make the line break.
printf("***********************************************************************\n");
printf("| %s |\n",string1); //user , String1
printf (" ---------------------------------------------------------------------\n");
System("whoami");
As you can see in the code I want the result of the whoami to go before the variable string1 but on the same line as the String1 since it is very important to keep the format because at the bottom there is a part of aesthetic ascci.