Bonjour,
Je viens d'arranger tout ça comme ça, mais ça ne marche pas, ça me renvoie dans la console, press a key to exit.. :s
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h> // Bibliothèques utiles
#include <io.h>
#include <fcntl.h>
#include <windows.h>
void exit_prog(char error_msg[]);
void press_key(char press_key_text[]);
FILE *ip_file=NULL;
char *ip_filepath=NULL;
long ip_file_length=0;
void exit_prog(char error_msg[])
{
printf("\n%s\n", error_msg);
_fcloseall( );
press_key("Press a key to exit...");
exit(0);
}
void press_key(char press_key_text[])
{
printf("%s", press_key_text);
while ( !_kbhit() )
{;}
_getch();
}
//=================================================
int main(int argc, char *argv[])
{
int size=0;
if (argc == 1)
{
//display_usage();
exit_prog("");
ip_filepath = &argv[1][0]; //ip_filepath pointe sur le premier argument premier caractere
ip_file = fopen(ip_filepath, "rb");
if(ip_file==NULL)
{ //test obligatoire
printf("Erreur a l'ouverture du fichier\n");
exit(0);
}
fseek (ip_file , 0, SEEK_END); //On se place a la fin du fichier
ip_file_length=ftell (ip_file ); //Retourne le nombre d'octet depuis le debut du fichier jusqu'a la position du curseur(ici la fin)
printf("Opening MPEG-2 file %s, %i bytes.\n", ip_filepath, ip_file_length);
char *Buffer=new char[ip_file_length];
fread(Buffer,sizeof(char),ip_file_length,ip_file); //On a tout le fichier recopier dans le Buffer
fclose(ip_file);
int i =0;
for(i=0 ; i<ip_file_length ; i++)
{
printf("%c\t",Buffer[i]); //Tu affiches tes octets
delete []Buffer;
return 0;
}}}