Well, yeah, I guess it's the correct way to load a file. Aside from the fact that there is no "The" way to do anything, that is. There's always different ways to do things.

But anyway your real question is "Why doesn't my code find the file?". And you've apparently found that it doesn't matter whether you use a constant value or a variable value -- why would it, anyway, they contain the same data?

The answer is that your code assumes your file is in your current working directory, whereas it's actually in some other directory. If you're going to use relative paths then you need to know about this concept, so have a look at the Wikipedia article: Working directory. It explains what it is and how to change it.