Click here to Skip to main content
15,905,912 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Reusing an Incremented Variable within a Single Statement Pin
Paul Michalik24-Aug-10 21:28
Paul Michalik24-Aug-10 21:28 
GeneralRe: Reusing an Incremented Variable within a Single Statement Pin
Stefan_Lang24-Aug-10 22:02
Stefan_Lang24-Aug-10 22:02 
RantRe: Reusing an Incremented Variable within a Single Statement Pin
JFDR_0225-Aug-10 6:37
JFDR_0225-Aug-10 6:37 
GeneralRe: Reusing an Incremented Variable within a Single Statement Pin
Skippums25-Aug-10 7:04
Skippums25-Aug-10 7:04 
GeneralRe: Reusing an Incremented Variable within a Single Statement Pin
Niklas L25-Aug-10 8:02
Niklas L25-Aug-10 8:02 
GeneralRe: Reusing an Incremented Variable within a Single Statement Pin
Skippums25-Aug-10 8:08
Skippums25-Aug-10 8:08 
GeneralRe: Reusing an Incremented Variable within a Single Statement Pin
Niklas L25-Aug-10 8:27
Niklas L25-Aug-10 8:27 
Questiondisplaying the layout of an ogg file Pin
rukita24-Aug-10 4:40
rukita24-Aug-10 4:40 
hello,
i am trying to write a code which will display the layout of an ogg page! but it seems to me that the result dispalyed is wrong! please can someone help me?? Sniff | :^) Cry | :((
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

typedef struct				
{
   char magic_number[4];// Magic_number « OggS »	
   int version;// version of the ogg bitstream	 format	
   long header_type;//Indicatess the type of page that follows 	
   int granule_position;// time marker in Ogg file
   long bitstream_serial_number;//is a serial number that identifies a page belonging to a particular bitstream.
   int page_sequence_number;/*this field is a monotonically increasing field for each logical bitstream
	for example the first page is 0, the next is 1 etc..*/
    int crc;//checksum of the data in the entire page
	int page_segments;// indicates the number of segment that exists in a page
	int segment_table;// indicates the length of each segment in the page
	
} OggS;
// Prototype des fonctions
   OggS* lecture(char*) ;

   
   
   //int conv (unsigned char hex[4],int) ;
main (void)
{
	char nom[100]; //pour stocker le nom et le chemin du fichier ogg
	OggS* ogg;   //pour récupérer les infos du fichier ogg

	printf("Veuillez entrer le nom et chemin du fichier OGG sans l'extension .ogg :\n");
	gets(nom); // on récupère le nom et le chemin de l'image
	strcat(nom,".ogg"); // on ajoute l'extension .ogg à ce fichier
	ogg=lecture(nom); //on utilise la fonction lecture pour récupérer les infos 
	printf ("The magic_number is:\t %.4s\n",ogg-> magic_number); //et on les affiche en parcourant les différents champs de la structure ogg
	printf ("Version du fichier :%d\n",ogg->version);
	printf ("Le type du header du fichier :\t %d\n",ogg->header_type);
	printf ("Le granule position du fichier :\t %d\n",ogg->granule_position);
	printf ("Le bitstream_serial_number :\t%d\n",ogg->bitstream_serial_number);
	printf ("page_sequence_number :\t %d\n",ogg->page_sequence_number);
	printf ("crc :\t\t %d\n",ogg->crc);
	printf ("page_segments :\t\t %d\n",ogg->page_segments);
	printf ("segment_table :\t\t\t %d\n",ogg->segment_table);
	
	
}

OggS* lecture(char* nom)
{
	unsigned char temp[4];	// chaine de carac temporaire qui sera utilisé pour récupérer les différentes infos 	
	OggS *ogg;		// variable renvoyée par la fonction
	FILE * fichier;		// un pointeur sur FILE
	ogg=(OggS*)malloc(sizeof(OggS)); // on alloue dynamiquement le pointeur sur OggS
	fichier = fopen (nom,"r");     // on ouvre le fichier en lecture seule
	
	fread (ogg->magic_number,4,1,fichier);	// on récupère le magic number
	fread (ogg->version,1,8,fichier);   // version 
	
	fread (ogg->header_type,1,8,fichier);	// header type
	ogg->header_type = conv (temp,2);	// que l'on converti aussi 
	
	fread (&temp,1,1,fichier);	// granule position
	ogg->granule_position = conv (temp,4);
	
	fread (&temp,1,1,fichier);	// bitsream-serailnumber
	ogg->bitstream_serial_number = conv(temp,4);
	
	fread (&temp,1,1,fichier);	// page sequence number	
	ogg->page_sequence_number = conv(temp,4);
	
	fread (&temp,1,1,fichier);	// crc
	ogg->crc = conv (temp,2);   
	
	fread (&temp,1,1,fichier);	// page segment
	ogg->page_segments = conv (temp,2);  
	
	fread (&temp,1,1,fichier);	// segment table
	ogg->segment_table = conv (temp,4);     
	
	fclose(fichier);
	return ogg;		// on retourne le pointeur sur la structure OggS
}


	
int conv (unsigned char hex[4],int nb)
{
	int res=0,i;
	for (i=nb-1;i>=0;i--)res=res*256+hex[i];
	return res;
}

AnswerRe: displaying the layout of an ogg file Pin
Richard MacCutchan24-Aug-10 5:31
mveRichard MacCutchan24-Aug-10 5:31 
GeneralRe: displaying the layout of an ogg file Pin
rukita24-Aug-10 22:40
rukita24-Aug-10 22:40 
GeneralRe: displaying the layout of an ogg file Pin
Richard MacCutchan25-Aug-10 0:21
mveRichard MacCutchan25-Aug-10 0:21 
QuestionGetting list of user accounts Pin
David Crow24-Aug-10 4:32
David Crow24-Aug-10 4:32 
AnswerRe: Getting list of user accounts Pin
Yusuf24-Aug-10 5:09
Yusuf24-Aug-10 5:09 
QuestionReset dwDesiredAccess, Pin
gothic_coder23-Aug-10 21:47
gothic_coder23-Aug-10 21:47 
AnswerRe: Reset dwDesiredAccess, Pin
Luc Pattyn24-Aug-10 1:09
sitebuilderLuc Pattyn24-Aug-10 1:09 
GeneralRe: Reset dwDesiredAccess, Pin
gothic_coder24-Aug-10 2:17
gothic_coder24-Aug-10 2:17 
GeneralRe: Reset dwDesiredAccess, Pin
gothic_coder24-Aug-10 3:14
gothic_coder24-Aug-10 3:14 
GeneralRe: Reset dwDesiredAccess, Pin
gothic_coder25-Aug-10 22:41
gothic_coder25-Aug-10 22:41 
QuestionMessage Removed Pin
23-Aug-10 20:53
sayonee23-Aug-10 20:53 
AnswerRe: Bitmapped button functionality Pin
Peter_in_278023-Aug-10 20:56
professionalPeter_in_278023-Aug-10 20:56 
GeneralRe: Bitmapped button functionality Pin
sayonee23-Aug-10 21:05
sayonee23-Aug-10 21:05 
GeneralRe: Bitmapped button functionality Pin
Richard MacCutchan24-Aug-10 2:49
mveRichard MacCutchan24-Aug-10 2:49 
QuestionError Message Pin
ganesh_IT23-Aug-10 19:20
ganesh_IT23-Aug-10 19:20 
AnswerRe: Error Message Pin
Niklas L23-Aug-10 19:38
Niklas L23-Aug-10 19:38 
QuestionHow to check dll's reference count? Pin
Jack2009523-Aug-10 16:45
Jack2009523-Aug-10 16:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.