Ofsteam leave brackets?

Hi, I need help with one problem. So, I need to make fstream not to be restricted by brackets.

1
2
3
4
5
6
7
8
9
..main..
{
...
if(infile == true) {
    fstream f(path, ios::out|ios::app);
} // I can't move this bracket.

Quite large program ..
}


I will be grateful for every help.
http://www.cplusplus.com/reference/fstream/ofstream/open/
1
2
3
4
5
6
7
{
  // create
  {
    // open
  }
  // more
}
Yes, but I mean something like leave extent.

Global initialization is excluded.

1
2
3
4
5
6
7
another function {
initialization fstream f // this fstream I want use in the whole of program
}

main {
using fstream f 
}
I want to omit global space.
1
2
3
4
5
6
7
void foo( fstream & );

int main()
{
  fstream f;
  foo( f );
}

Topic archived. No new replies allowed.