› Foros › Multiplataforma › Desarrollo
int write_file(const char *readpath, const char *writepath) {
check(readpath);
if(exist == 1) {
int fdin;
int fdout;
fdin = sceIoOpen(readpath, PSP_O_RDONLY, 0777);
if(fdin >= 0) {
int bytesRead = 1;
fdout = sceIoOpen(writepath, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);
bytesRead = sceIoRead(fdin, write_buffer, sizeof(write_buffer));
while((bytesRead > 0) && (fdout >= 0)) {
sceIoWrite(fdout, write_buffer, bytesRead);
bytesRead = sceIoRead(fdin, write_buffer, sizeof(write_buffer));
}
if(fdout >= 0) {
sceIoClose(fdout);
}
if(fdin >= 0) {
sceIoClose(fdin);
}
}
return 1;
}else{
return 0;
}
}
write_file("flash1:/archivo.prx", "ms0:/archivo.prx");
int write_file("flash1:/archivo.prx", "ms0:/archivo.prx"); {
check(readpath);
if(exist == 1) {
int fdin;
int fdout;
fdin = sceIoOpen(readpath, PSP_O_RDONLY, 0777);
if(fdin >= 0) {
int bytesRead = 1;
fdout = sceIoOpen(writepath, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);
bytesRead = sceIoRead(fdin, write_buffer, sizeof(write_buffer));
while((bytesRead > 0) && (fdout >= 0)) {
sceIoWrite(fdout, write_buffer, bytesRead);
bytesRead = sceIoRead(fdin, write_buffer, sizeof(write_buffer));
}
if(fdout >= 0) {
sceIoClose(fdout);
}
if(fdin >= 0) {
sceIoClose(fdin);
}
}
return 1;
}
else {
return 0;
}
}