i need to open a file whose name i only know part of until runtime.
it is based on a char value.
the char represents gender and is either 'm' or ''f'
i need to load from a text file called names_m.txt or names_f.txt but i don't know until runtime.
i tried this but it didnt quite work...
i want to use an fstream to open the file in the folder 'data' at the working directory
it is based on a char value.
the char represents gender and is either 'm' or ''f'
i need to load from a text file called names_m.txt or names_f.txt but i don't know until runtime.
i tried this but it didnt quite work...
Code:
char fileName[18] = {"/data/names_"}; fileName[13] = gender; fileName[14] = '.'; fileName[15] = 't'; fileName[16] = 'x'; fileName[17] = 't'; fileName[18] = '\0';
Comment