I\'m trying to write the contents of buf pointer to the file created by ofstream.
For some reason the file is empty, however the contents of buf is never empty... What
You should check that the ofstream is open for writing after being created.