C++ txt file update code(can't find it anywhere except my blog)