What is PATH, and when to use it in C++

Ask a question+

What is PATH, and when to use it?

add comment

1 Answer


PATH in C++ and many other languages is the full file path to the location the file is being run at.

So if you were in C:/users/Ryan/testFolder/C++/a.out

your path would be C:/users/Ryan/testFolder/C++/

You would use it if you do not know where it would be being run from, for example, if you handed me the code you would still want it to be able to find other folders, for example, if you had C:/users/Ryan/testFolder/Pictures and you wanted me to have access, given the previous example it could be PATH/Pictures

Then even when it is put on my computer, the path will still work as it is a relative file path.

Lainrawr 305
add comment

Your Answer