| | |
spaces in binary file not showing
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
I am trying to open a mp3 to read the ID3 tag information, when the mp3 is opened in an ASCII editor I can see all the information I want, including spaces. But...
When I try running the following chunk of code on that same mp3, I get the same thing, except all the spaces are missing.
I've tried opening the file as both ascii and binary, using the >>
operator and mp3.get(stream[i]) notation, but there is never a space. As a last resort I tried casting off all the characters to ints and looking at that, but the space isn't there.
Is there something I am doing wrong?
When I try running the following chunk of code on that same mp3, I get the same thing, except all the spaces are missing.
C++ Syntax (Toggle Plain Text)
for (int i=0; i<350; i++) { mp3 >> stream[i]; cout << stream[i]; }
I've tried opening the file as both ascii and binary, using the >>
operator and mp3.get(stream[i]) notation, but there is never a space. As a last resort I tried casting off all the characters to ints and looking at that, but the space isn't there.
Is there something I am doing wrong?
its probably because what you see in the ascii editor are not spaces at all. Many editors, such as Notepad will display non-printable characters as spaces. What makes you think that file contains spaces? binary files contains all sorts of stuff that are meaningless to ascii edits. If you realy want to see what is in the file, and you are on MS-Windows os, you can use debug.exe that is in the MS-Windows installation directory -- that program has been distrubuted with every M$ operating system since MS-DOS 1.0 over 20 years ago. It has a split screen. On the left side is the hex values of every byte in the file. The right side contains the ascii values where non-printable bytes are displayed as a '.' (period).
the reason I say they are spaces is because they part of the file that I am looking at is the ID3 tag of an MP3. In the ID3 tag, you can store information about an mp3 such as the artist, album, title, etc....
When I open the file in winamp I can see the space between "The Beatles" under the artist field, and I see it in my ASCII editor.
When I open the file in winamp I can see the space between "The Beatles" under the artist field, and I see it in my ASCII editor.
![]() |
Similar Threads
- Read a string from a binary file into a C or C++ string (C++)
- Reading a Binary file using Visual Basic (Visual Basic 4 / 5 / 6)
- Reading a Binary File to a C++ Class (C++)
- binary file manipulations (C)
- C++ raster files (writing structs to a binary file) (C++)
Other Threads in the C++ Forum
- Previous Thread: Doubts in i/o and others in 'C'
- Next Thread: Some thingthat we can do in C and Not in C++
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib linkedlist linker list loop looping loops map math memory multiple news node number numbertoword output parameter pointer problem program programming project python random read recursion recursive reference rpg sorting string strings temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






