Problem with sceIOwrite

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
PeterLeRoi
Posts: 31
Joined: Wed May 16, 2007 11:08 am

Problem with sceIOwrite

Post by PeterLeRoi »

I need to write a wav header and I´m using:

Code: Select all

  
void GrabaWAV(char *name,int size){
  int sstg = sceIoOpen(name, PSP_O_WRONLY | PSP_O_CREAT , 0777);
  sceIoWrite(sstg, "RIFF",4*sizeof(char));
  sceIoWrite(sstg, size + 36,sizeof(int));  //This line has a problem
  sceIoWrite(sstg, "WAVE",4*sizeof(char));
The problem is: when the psp reaches the fourth line, it freezes and turns off. I can´t see the problem... :'(

Anybody can help me? Thanks ;)

Edit: Somebody could explain why it can write chars without any problems, but can´t write an integer?
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

Pay attention to the compiler warnings -- sceIoWrite doesn't take an integer as the second parameter, it takes a pointer. You probably wanted something like

Code: Select all

int val = size + 36;
sceIoWrite(sstg, &val, sizeof(int));
Post Reply