the problem is that im geting this error in my psp program
main.c (86) : warning: passing argument 1 of 'sceIoRead' makes integer from pointer without a cast
main.c (87) : warning: passing argument 1 of 'sceIoWrite' makes integer from pointer without a cast
PsPfReAK wrote:as you can tell im a noob seeking for help
lol
the problem is that im geting this error in my psp program
main.c (86) : warning: passing argument 1 of 'sceIoRead' makes integer from pointer without a cast
main.c (87) : warning: passing argument 1 of 'sceIoWrite' makes integer from pointer without a cast
MBx wrote:your code compiled well on my PC, I haven't test it to see if it works or not but it compiled.
do you have a compile problem?
no it compiled fine, but say if you put the test.txt in the same directory as the eboot (with txt in it) it only flashes an empty file, or it may just fail...
i'll check back here later or tomorrow, thank you for your helo so far
sceIoWrite needs aligned buffers, which you might not have. Unless you really know what you're doing, just use the standard functions like open() and write() instead, as they already take care of this sort of thing.
jimparis wrote:sceIoWrite needs aligned buffers, which you might not have. Unless you really know what you're doing, just use the standard functions like open() and write() instead, as they already take care of this sort of thing.
If you mean changing test_buffer and size and such, then test_buffer and the size argument would just be changed to the buffer containing the binary(and if it was large, you'd do a loop)
int flash_file(char *filedest, char *filesrc)
{
int fd0 = sceIoOpen(filesrc, PSP_O_RDONLY, 0777);
int fd1;
if(fd0 <= 0) return -1;//No good, head back with error
int len = sceIoLseek(fd0, 0, 2); sceIoLseek(fd0, 0, 0);//2 means SEEK_END, just a habit I have. Grabs the length of the file. Then it returns to the beginning.
char buffer[0x1000];//We'll use a buffer the size of 0x1000 for this.
//Loop time
int byteswritten;
fd1 = sceIoOpen(filedest, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);//open up dest in create, truncate, and write mode
while(byteswritten < len)
{
int counter = len-byteswritten;//Just to make things easier
sceIoRead(fd0, buffer, counter >= 0x1000? 0x1000: 0x1000-counter);//If counter is greater than 0x1000, then go ahead and do it normally, else get the difference, so we don't overwrite.
byteswritten += sceIoWrite(fd1, buffer, counter >= 0x1000? 0x1000: 0x1000-counter);//Write the same condition as before
sceIoLseek(fd0, byteswritten, 0); sceIoLseek(fd1, byteswritten, 0);//Seek to the offset on both
}
return 0;//Return no error
}
If there are errors, my bad, it's 2 in the morning.
If you mean changing test_buffer and size and such, then test_buffer and the size argument would just be changed to the buffer containing the binary(and if it was large, you'd do a loop)
int flash_file(char *filedest, char *filesrc)
{
int fd0 = sceIoOpen(filesrc, PSP_O_RDONLY, 0777);
int fd1;
if(fd0 <= 0) return -1;//No good, head back with error
int len = sceIoLseek(fd0, 0, 2); sceIoLseek(fd0, 0, 0);//2 means SEEK_END, just a habit I have. Grabs the length of the file. Then it returns to the beginning.
char buffer[0x1000];//We'll use a buffer the size of 0x1000 for this.
//Loop time
int byteswritten;
fd1 = sceIoOpen(filedest, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);//open up dest in create, truncate, and write mode
while(byteswritten < len)
{
int counter = len-byteswritten;//Just to make things easier
sceIoRead(fd0, buffer, counter >= 0x1000? 0x1000: 0x1000-counter);//If counter is greater than 0x1000, then go ahead and do it normally, else get the difference, so we don't overwrite.
byteswritten += sceIoWrite(fd1, buffer, counter >= 0x1000? 0x1000: 0x1000-counter);//Write the same condition as before
sceIoLseek(fd0, byteswritten, 0); sceIoLseek(fd1, byteswritten, 0);//Seek to the offset on both
}
return 0;//Return no error
}
If there are errors, my bad, it's 2 in the morning.
haha 2, so im gonna try and copy npaste this over my int flash_file and insert the file source and dest????
and what do know an error, lol
main.c: In function 'flash_file':
main.c (71) : warning: 'byteswritten' may be used uninitialized in this function