If you are working on master, then you can use the FileAccess class in core/io/file_access.h.
This is probably a better idea than rolling your own, as it can interoperate with Godot projects, and also has a bunch of useful methods that work with Godot objects.
Though I don't know what you are doing, so rolling your own may work for certain stuff too.