|
-
Jun 12th, 2001, 12:52 PM
#1
Thread Starter
Lively Member
Open a file in binary mode
How do I open a file in binary mode in C++ (using Borland C++ Builder 5)?
What I need to do is to erase the ID3-tag of an mp3, and in VB you opened it in binary mode and wrote nothing to the 127 first bytes or something like that. I was thinking I could do that again, but in C++ instead. Any ideas how?
-
Jun 12th, 2001, 03:00 PM
#2
Monday Morning Lunatic
In BCB there's probably a class somewhere to do it, but here's the method a REAL programmer might use 
Code:
#include <stdio.h>
#include <io.h>
#include <fcntl.h>
// ...inside some function somewhere...
int fd = _open("thefile.ext", _O_BINARY | _O_RANDOM | _O_RDWR | _O_APPEND, _S_IREAD | _S_IWRITE);
Look up _open, _close, _read, _write in MSDN for more details on their exact parameters
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jun 13th, 2001, 09:13 AM
#3
Thread Starter
Lively Member
Thanks parksie, it worked great!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|