There's been a lot of these up here lately, but...
basically, this doesn't work
but if i take the code out of the function and put it in main(), it works fine...Code:void genPlayer(hck::plyr player[], int playerid){ char* filename; strcpy(filename,player[playerid].alias.c_str()); strcat(filename,".hack"); cout << filename << endl; /*debugging line to see if the filename is right, not needed*/ cin.ignore(); /*and a pause so i can look at it*/ ofstream player_file; player_file.open(filename); player_file << player[playerid].alias << " "; player_file.close(); return; }
Can someone explain?(and hopefully give a solution)
edit: Also, when i use it like this, it doesn't cout filename like I tell it to, and it disregards my cin.ignore()