| | |
Renaming files in C++
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
I'm trying to use sequential binary file editing in C++. I use a temporary file. I have to make the changes in the file by storing the modified data in the temp file. Then I delete the original file and rename the temp as the original. The problem is the remove() and rename() functions in <fstream.h> don't seem to be working. When I check in the folder after execution, the temp file is still there and so is the original file. Does any1 know an alternative method to remove and rename a file during runtime?
•
•
•
•
Originally Posted by iamboredguy
I'm trying to use sequential binary file editing in C++. I use a temporary file. I have to make the changes in the file by storing the modified data in the temp file. Then I delete the original file and rename the temp as the original. The problem is the remove() and rename() functions in <fstream.h> don't seem to be working. When I check in the folder after execution, the temp file is still there and so is the original file. Does any1 know an alternative method to remove and rename a file during runtime?
http://www.cplusplus.com/ref/cstdio/rename.html
http://www.cplusplus.com/ref/cstdio/remove.html
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
![]() |
Similar Threads
- Renaming Files Help (Python)
- renaming files through batch scripts... (Windows NT / 2000 / XP)
- Renaming files with awk/sed (Shell Scripting)
- Renaming files on Tiger desktop (Mac Software)
- disable renaming files with left-click (Windows NT / 2000 / XP)
- disable renaming files with left-click (Windows NT / 2000 / XP)
- Files won't move or delete! (Storage)
Other Threads in the C++ Forum
- Previous Thread: ODBC with Visual C++
- Next Thread: probelm with <fstream>; saving characters
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer dll download dynamiccharacterarray email encryption error file forms fstream function functions game generator getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






