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.

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;
   }
}

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.

I suggest posting it if you can, I'm sure we can help you condense it.

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?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.