I created a function to save a text file using <fstream>
.
void save(AnsiString flName, AnsiString &YourText) {
char saving[strlen(YourText.c_str())]; // << ERROR
strncpy(saving, YourText.c_str(), sizeof(saving) - 1);
ofstream ok(flName.c_str(), ios::out);
ok << saving;
ok.close();
}
I have problems in line 2. said: Constant expression required
can you help me. whether there are other more effective method to save a text file?