Skip to main content
gamedev.net
🔒 Locked

wifstream

Started by kuharh 0 replies 500+ views
Original Post
kuharh
kuharh
I am working on a routine that loads a script file. The function I am using is getting big so I want to split it up. When I tried to pass the file stream (wifstream) to another function the debug spew says there is no convertion from wifstream to wifstream. Why can't I pass a wifstream between functions. function1(...) { wifstream file(...); ... function2(file); } function2(wifstream file) { ... }
twanvl
twanvl
No you can't, copying a stream would mean you could be reading at two different places in the file at the same time. Instead pass the stream by reference:
void function2(wifstream& file)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.