Click here to Skip to main content
15,922,650 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Reusing an Incremented Variable within a Single Statement PinPopular
Luc Pattyn24-Aug-10 5:50
sitebuilderLuc Pattyn24-Aug-10 5:50 
GeneralRe: Reusing an Incremented Variable within a Single Statement Pin
Skippums24-Aug-10 6:15
Skippums24-Aug-10 6:15 
GeneralRe: Reusing an Incremented Variable within a Single Statement Pin
Luc Pattyn24-Aug-10 6:33
sitebuilderLuc Pattyn24-Aug-10 6:33 
GeneralRe: Reusing an Incremented Variable within a Single Statement Pin
Skippums24-Aug-10 6:54
Skippums24-Aug-10 6:54 
GeneralRe: Reusing an Incremented Variable within a Single Statement Pin
Aescleal24-Aug-10 6:42
Aescleal24-Aug-10 6:42 
GeneralRe: Reusing an Incremented Variable within a Single Statement Pin
Skippums24-Aug-10 7:06
Skippums24-Aug-10 7:06 
GeneralRe: Reusing an Incremented Variable within a Single Statement Pin
Aescleal24-Aug-10 8:23
Aescleal24-Aug-10 8:23 
GeneralRe: Reusing an Incremented Variable within a Single Statement [modified] Pin
Joe Woodbury24-Aug-10 6:52
professionalJoe Woodbury24-Aug-10 6:52 
GeneralRe: Reusing an Incremented Variable within a Single Statement Pin
Niklas L24-Aug-10 7:08
Niklas L24-Aug-10 7:08 
GeneralRe: Reusing an Incremented Variable within a Single Statement [modified] Pin
Joe Woodbury24-Aug-10 7:25
professionalJoe Woodbury24-Aug-10 7:25 
GeneralRe: Reusing an Incremented Variable within a Single Statement Pin
Niklas L24-Aug-10 7:55
Niklas L24-Aug-10 7:55 
GeneralRe: Reusing an Incremented Variable within a Single Statement Pin
Skippums24-Aug-10 7:17
Skippums24-Aug-10 7:17 
GeneralRe: Reusing an Incremented Variable within a Single Statement Pin
Joe Woodbury24-Aug-10 7:38
professionalJoe Woodbury24-Aug-10 7:38 
GeneralRe: Reusing an Incremented Variable within a Single Statement Pin
Paul Michalik24-Aug-10 8:00
Paul Michalik24-Aug-10 8:00 
GeneralRe: Reusing an Incremented Variable within a Single Statement Pin
Joe Woodbury24-Aug-10 8:50
professionalJoe Woodbury24-Aug-10 8:50 
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 

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.