I'm writing code on C++ that will map to the nearest available drive using "net use * \server...etc" and afterwards I want to open a file on it.
Is there a command that will let me interact with this new drive without needing to know on which drive it was mapped beforehand? (Usually it will be drive Z:, but not always!)
Clearer example:
system("net use * \\server\folder\ p455word /user:server\user /p:no")
(output: "Server succesfully mapped to drive Z:")
Then I would normally try to open the file:
system("Z:\\folder\mydoc.docx")
My question is on how to do this:
system("*\\\folder\mydoc.docx")
With * being whatever the drive the computer chose to map to, or if there's a workaround to this. Thanks!