Yes, but those files are on your local PC, while the code you run on OnlineGDB runs on the server (Linux, mind you, not Windows). There's no C:\code directory there (there isn't even a C: drive on a Linux machine).
If you want to access a file in a code running on OnlineGDB, add that file to your project. There's an upload button left of the green RUN button.
In case the question is not in context of OnlineGDB and you are running the code on your local machine (not in OnlineGDB), please share your exact code that doesn't seem to work. (A guess here: maybe you did not escape your string properly? C:\code path escaped properly should look like "C:\\code" (notice the double backslashes)).