   filestream from char* crashing program
  i have a text file that i get information from during my game. to read the text in, i use the fstream.h, and the ifstream object:ifstream in_file;thats fine. ive narrowed the crash down this this line:in_file >> newSprite->file;newSprite is defined as:cSprite* newSprite = new cSprite;file is of type char* ( a string). and because it is a pointer, in the constructor of cSprite, i did this: file = new char; to create it. but it crashes at this point. and only this point, why? 
  It sounds like your char * (newSprite->file) points to invalid memory. You could either:1) Consider using std::string2) Allocate memory for the variable beforehand.If you chose to go with (2), you will probably want to read your variable in a way that doesn''t make it suspectible to a buffer overflow, like it does now.I would recommend (1).;  file = new char will only make space for one character. allocate an array of chars like file = new char[256] or whatever number you think the string will fit in.   :::: [ Triple Buffer V2.0 ] ::::;  that did it. ;  by the way ... using a "std::stringstream", from the header file  will eliminate crashed due to overflowing your buffer ... if you use new char[256], your program runs great until a 256 or higher path is entered ... if you use a stringstream ... it grows dynamically as needed. ;  And you should be using fstream, not fstream.h.   [ Google || Start Here || ACCU || STL || Boost || MSDN || GotW || MSVC++ Library Fixes || BarrysWorld || E-Mail Me ] 