Hi,
You said I had to map the current file at a seek point
but I just can't do itn there's a problem with the function mmap itself
here's my source: (from minimad)
int main(int argc, char *argv[])
{
struct stat stat;
void *fdm;
if (argc != 1)
return 1;
int fd;
FILE*fichier=fopen("essai.mp3","r+");
fd=fileno(fichier);
lseek(fd,10,SEEK_SET);
if (fstat(fd, &stat) == -1 ||
stat.st_size == 0)
return 2;
fdm = mmap(0,stat.st_size/2-1 , PROT_READ, MAP_SHARED,
fd,stat.st_size/2);
if (fdm == MAP_FAILED)
return 3;
decode(fdm, stat.st_size/2-1);
if (munmap(fdm, stat.st_size/2-1) == -1)
return 4;
return 0;
}
I've got an error return 22
I know it's because the offset is not set to 0
thanks for your help