Hello Everyone, I haven't posted here in a while.

The problem I am having seems a simple one and I must be missing something quite basic but I just can't work out what. Below is some snippets of code from a program I am writing at the moment (there is too much source code to post the whole program), but for some reason the fstream 'open' method either fails or crashes at runtime and I can't work out why.

Neural_network.h File:
Code:
/* Some includes and defines here - no problems here */

class CSPNeuralNetwork
{
      private:
              /* Neural Network file instance */
              std::fstream io_file;
              
              /* Neural Network */
              SNeuralNetwork * neural_network;
              
              /* Private Methods */
              bool LayerNumberValid(unsigned int layer_num);
              bool NeuronNumberValid(unsigned int layer_num, unsigned int neuron_num);
              
      public:
             /* Constructors/Destructors */
             CSPNeuralNetwork();
             CSPNeuralNetwork(unsigned int n_layers);
             ~CSPNeuralNetwork();
             
             /* Public Methods */
             SNeuralNetwork * GetNeuralNetwork();
             
             /* Dat file output methods - Used for outputting neural network info */
             bool SaveANN(char * filename);
             bool SaveANN(char * filename, SNeuralNetwork * net);
             bool SaveANN(const char * filename);
             bool SaveANN(const char * filename, SNeuralNetwork * net);

             /* More Methods after this, but they work fine (as far as I know) */
};
neural_network.cpp - Problem when I try and save a neural network setup to file
Code:
bool CSPNeuralNetwork::SaveANN(char * filename)
{
     return SaveANN( (const char *)(&filename), neural_network );
}

bool CSPNeuralNetwork::SaveANN(char * filename, SNeuralNetwork * net)
{
     return SaveANN( (const char *)(&filename), net );
}

bool CSPNeuralNetwork::SaveANN(const char * filename)
{
     return SaveANN( filename, neural_network );
}

bool CSPNeuralNetwork::SaveANN(const char * filename, SNeuralNetwork * net)
{
     char temp_buff[DEF_BUFF_SIZE];
     unsigned int pos_x = 0, pos_y = 0;
     
     /* Open the file specified */
     io_file.open( filename, std::fstream::in | std::fstream::out | std::fstream::trunc );
     
     if( !io_file.is_open() )
     {
         return true;
     }

     /* More code here ... */
}
main.cpp - where the class methods are actually called:
Code:
    /* Tried it this way to start with */
    sprintf(temp_buff, "ANN SAVE FILE.txt");
    
    if( sp_ann.SaveANN(temp_buff) )
    {
        sp_out.WriteToLog(" - Neural Network was unable to be saved to file...\n");
        exit(1);
    }
Also Tried it like this:
Code:
    if( sp_ann.SaveANN("ANN SAVE FILE.txt") )
    {
        sp_out.WriteToLog(" - Neural Network was unable to be saved to file...\n");
        exit(1);
    }
Whenever I try the code above the SaveANN method always return true, but I also tried opening the file by using the following line of code in the SaveANN method:
Code:
io_file.open( "ANN SAVE FILE.txt", std::fstream::in | std::fstream::out | std::fstream::trunc );
But that causes a runtime error for some reason. Any suggestions?