voila ce que je fais :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 
#include <iostream>
#include <stdlib.h>
#include <string>
#include <fstream> 
 
using namespace std;
 
int main(int argc, char *argv[])
{
	std::string fIn="jules.mp3";
 
    std::ifstream fichier(&fIn[0], std::ios_base::binary ); 
 
    if (!fichier) { std::cout<<"ne peut ouvrir le fichier :"<<fIn<<endl; return -1; }
 
// recupere la taille des infos a lire
    fichier.seekg (0, std::ios_base::end); 
    int length = fichier.tellg(); 
    fichier.seekg (0, std::ios_base::beg); 
 
// on lit le fichier
    std::string str(length, 0); 
    fichier.read(&str[0], length);
 
    fichier.close();
 
int len=str.length();
const char *tmp=str.c_str();
char *mus = new char(len+1);
int i;
for (i=0; i<len; i++)
{	mus[i]=tmp[i]; }
mus[i]='\0';
 
  return 0;
}
et dans ma boucle for a un moment alors que je ne suis toujours pas arrive a i=len le programme me ressort l'erreur 'Access Violation'.
Je suis sous VC+. et jules.mp3 proviens du package de fmod.