Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3029

crashing on fstream open file

$
0
0
I get expression: stream != NULL debug assertion failed. everyone says this is because its not opening the file correctly but I will post my code and tell you what the filename var is at when I'm opening.

Code:

private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e) {
        if(textBox1->Text[0] == (char)'\0' || textBox2->Text[0] == (char)'\0'){
                      MessageBox::Show("Please select a valid m3u and path", "Problem",
                                MessageBoxButtons::OK, MessageBoxIcon::Exclamation);
                }
                else{
                        button3->Text = "Working...";
            ReadList();
                }
                }
public: int Form1::ReadList(){
        ifstream pile;
                int count = 0;
                char inputbuff[100] ={'\0'},*tok,*folder;
                String^ poo = textBox1->Text;
                progressBar1->Maximum = File_Quant(poo);
crash here  ----> pile.open(ConvertString(poo),ifstream::in);
                if(!pile.good()){
                        MessageBox::Show("Please select a valid m3u and path", "Problem",
                                MessageBoxButtons::OK, MessageBoxIcon::Exclamation);
                        pile.close();
                                exit(1);
                }
public: char* Form1::ConvertString(String^ cnv){
        int length = cnv->Length;
        char *out = new char[length+1];
      for(int i = 0;i < length;i++){
        out[i] = (char) cnv[i];
                out[length] = '\0';
                }
          return out;
                }

I would really like some help with this because I'm doing this for my brother its a playlist backuper for winamp.

Viewing all articles
Browse latest Browse all 3029

Latest Images

Trending Articles



Latest Images