cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Problem with file output
Problem with file output
Jan 16, 2009 at 3:44am UTC
akmal4ik
(59)
Hello everybody, here is my problem
i have some file which contain random data
for example:
sadasjdgjdsdfsdffsdsasdrgfsdfjdfjkbdkjf
....
how i can insert random character as first character
of this file
c
sadasjdgjdsdfsdffsdsasdrgfsdfjdfjkbdkjf....
please help, and sorry for my english=)
Jan 16, 2009 at 3:53am UTC
Malachi
(72)
The only way I know how to do that is to read the file into a buffer, then using ios::trunc put your new output into the file, and then the contents of the buffer.
Perhaps someone knows a better way to do this than me...
Jan 16, 2009 at 4:00am UTC
helios
(17607)
No, there's no other way.
The only file operations are clear, append, and changing the value of random bytes.
Topic archived. No new replies allowed.