C
Christian Henke
Hi!
maybe someone can help me?!
I want to use fstream to read an .au file . This .au file includes
multiple information in its header. a MagicNumber, the No of Channels
used, and so on.
In hex code the data is 2e736e64 (the magic number). But when i read
the number with fstream i get 646e732e. Why are the numbers messed up
in order?!
I am using g++ 2.95.
Here is my source code:
AudioFile::AudioFile(char* auFile_Name)
{ // konstruktor übergebende Name ist die einzulesende Datei
Filename = auFile_Name;
fstream ein(auFile_Name, ios::in || ios::binary);
ein.read((char *) &(AuHeader), sizeof(struct Header_Data));
// struct Header_Data is shown below in .h file
cout << AuHeader.Magic_Number;
cout << AuHeader.DataLength;
}
typedef struct Header_Data { // Attributreihe die im Header der
..au Dateien enthalten ist
signed int Magic_Number;
signed int Header_Size;
signed int Data_Length;
signed int Encoding_Type;
signed int Sample_Rate; // Abtastfrequenz
signed int Channels; // Mono oder Stereo
} Header_Data;
Thanks
Chris
maybe someone can help me?!
I want to use fstream to read an .au file . This .au file includes
multiple information in its header. a MagicNumber, the No of Channels
used, and so on.
In hex code the data is 2e736e64 (the magic number). But when i read
the number with fstream i get 646e732e. Why are the numbers messed up
in order?!
I am using g++ 2.95.
Here is my source code:
AudioFile::AudioFile(char* auFile_Name)
{ // konstruktor übergebende Name ist die einzulesende Datei
Filename = auFile_Name;
fstream ein(auFile_Name, ios::in || ios::binary);
ein.read((char *) &(AuHeader), sizeof(struct Header_Data));
// struct Header_Data is shown below in .h file
cout << AuHeader.Magic_Number;
cout << AuHeader.DataLength;
}
typedef struct Header_Data { // Attributreihe die im Header der
..au Dateien enthalten ist
signed int Magic_Number;
signed int Header_Size;
signed int Data_Length;
signed int Encoding_Type;
signed int Sample_Rate; // Abtastfrequenz
signed int Channels; // Mono oder Stereo
} Header_Data;
Thanks
Chris