Hi guys,
So I've been trying to make a program that is placed on my external hard drive. It contains 5 folders which 3 require passwords. Although when I open the files using the system("K:\Master\School"); line, it sometimes just opens the C:\. I know it's because the driver's letter changes between computers and so I am in need of help for a line that either changes the letter, finds the files path, or any other way possible to open it. And if possible, will this work if the files are made hidden?
Thanks for the quick reply LB,
But I already tried that. I'm talking about when the external hard drive is removed and plugged into another computer. Since it assigns it the next available letter. For example, my home laptop assigns it as "K:\" yet the computers at my school range from "D:\" to "E:\" to "H:\". I may of not been clear, is there a code that FINDS the path for the folders or just changes the letter of the driver? Maybe to a letter than would hardly be used such as "Z:\"?
To Expand on LB's statement, you're limited to using FindFirstVolume and FindNextVolume and trying every path available on the machine or similar methods.
Yes it is being run from the external drive. Is there a code that will find the path regardless of the drivers assigned letter? The setup is a folder named "Master" which has the 5 sub folders which include "School", "Programming" and "Movies". The master folder will be made hidden and the program will autorun when the external drive is plugged in. The program asks for the folder and if required, a password. Yet I've been having trouble getting the driver as the same letter in the code. And sometimes it just opens the C:\ regardless of what you write
I tried std::string path = "/path/to/file.txt"; and nothing happens. I tried using system("explorer \Master\School"); and it still opens C:\
I'm trying to open a folder, not a file, if that helps at all?
I've also gone into cmd and typed in the command "explorer K:\Master\School" and it opens the correct folder. Although if I am to use that, and go to another computer I again have the problem of the assigned letter being different.
Please be certain you are running the program from the external drive. Try creating a text file with nothing in it just to see where it gets created - if it gets created somewhere other than the external drive, you are not running the program correctly.
in it, and it creates the file inside the folder where main.cbp is located. And I cant move the Master Folder inside where it is because the program is located inside the Master folder.
. It only created the test.txt and opened up C:/Users/Nick/Documents. The test.txt file was created where the main.exe was placed, which was outside of the Master folder but still on the external drive.