I need help with saving. (may be an obvious solution)

I am sort of a beginner to c++ and know basic console items and functions.

I need help with a text based game where the problem is saving.

I know how to save but how can I make the save function always accessible?

such as


cin >> input;

input = (char) toupper(input);


if (input == 'S')
{
save code here
}
Last edited on
By "always accessible" do you mean a global function?

You can define your save function in any translation unit, and declare
 
extern void savefunc(/*You arguments here*/);


in other translation units so you can call it.
Alright. Thank you! (:
Topic archived. No new replies allowed.