3
I am developing a C++ program that should read the keyboard data store them with hash, after performing the reading it must have in its main menu the save option.
I can read the save files using the hash and all.
The problem is at the time of creating the file, I would like to do a for that create the files with the default name, example
data_1
data_2
data_3
assim por diante
I made this code, but for some reason it creates only the file of zero index and as if I kept repeating the name and replacing the file 4 times that is the size of the defines TAM
;
void func_arquivo::cria_arquivo(){
ofstream arquivo;
for(int i=0;i<TAM;i++){
char nome[TAM];
sprintf(nome, "Data-%d.txt",i);
arquivo.open(nome, ios::app);
arquivo.close();
}
}
what size of the variable
TAM
even?– Christian Felipe
the size of the TAM define is 4!
– Eduardo