0

Ok so when makeing my program these errors come up:
Error:jump to case lable
Error: crosses initialization of 'std::ofstream a_file'
The ofstream one repeats twice referring to the same line. Can anyone help me. I can't post the code as this is from my iPod.

2
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by pseudorandom21
0

The switch is a primitive form of "if/else" structure, are you trying to use an fstream declared in a case label in another case label?

Here's how I normally use my switch's

switch( condition )
{
   case ONE:
   {
      break;
   }
   case TWO:
   {
      break;
   }
}
0

Well that might be my problem as I don't have an internal nbraket. If that doesn't work I have an old program that has 102 if/else statements and one additional else statement (It was a number recognition program that instead of just putting the users imput up had text in it like zero instead of 0) I need fifty switch statements and ofstreams for this (I see a pillow on my desk in the near future) the purpose is to make a file creating thing. Its complicated but I might post it when I'm done; can't try your solution computer trying to make a tarball of a folder for me.

0

I just changed all the switch cases to ifs and it worked itself out. If there a normal history of ofstream and switch cases having issues with each other?

0

I just changed all the switch cases to ifs and it worked itself out. If there a normal history of ofstream and switch cases having issues with each other?

If you aren't using scope properly there is.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.