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.

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) 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.

The >> operator strips the spaces. If you want to retain them use read() function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.