c++ - Cannot write files using ofstream -


i got problem code, want write files path doesn't seems work. here's code:

void writeonfile(const char *path) {     ofstream filetolog;     filetolog.open(path);     if (filetolog)         filetolog<< "--[[ test ]]\n"; } 

and call writeonfile that:

writeonfile("c:/logs/lua/testing/filename.lua"); 

but doesn't work. tried without if (filetolog) it's same. me please?

your code won't create file if 1 of folders "c:/logs", "c:/logs/lua", "c:/logs/lua/testing" not exist.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -