 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Tue Apr 04, 2006 1:15 pm Post subject: Write to file? |
|
|
| Code: | void read_to_ram() {
int fd;
int cpa = 8; //defines the position of characters of interest
int cpb = 9; //
int cpc = 10; //
int cpd = 11; //
fd = sceIoOpen("flash0:/vsh/etc/version.txt", PSP_O_RDONLY, 0777);
sceIoRead(fd,data,256);
sceIoClose(fd);
printf(" PSP Unit Firmware Version Check: ");
printf("version ");
printf("%c",data[cpa]);
printf("%c",data[cpb]);
printf("%c",data[cpc]);
printf("%c",data[cpd]);
printf("\n");
int fdo;
fdo = sceIoOpen("ms0:/debug.txt", PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);
sceIoWrite(fd,"ms0:/version.txt", 256);
sceIoClose(fdo);
}
|
Hello,
I'm trying to write this file back from RAM to memory stick.
THe file reads to RAM ok, and the version number is printed to screen,
but the file that gets written to ms is a small section of my program's source code.
Cheers, Art. |
|
| Back to top |
|
 |
cheriff Regular
Joined: 23 Jun 2004 Posts: 262 Location: Sydney.au
|
Posted: Tue Apr 04, 2006 1:51 pm Post subject: |
|
|
sceIoWrite(fd,"ms0:/version.txt", 256);
is trying to write 256 letters of the string "ms0:/version.txt", to the file pointed to by fd, ie flash0:/vsh/etc/version.txt. Maybe it's lucky that you opened it read only then?? :)
if you just want to copy it ts ms:/xxxx then:
sceIoWrite(fdo,data, 256);
might do the trick. _________________ Damn, I need a decent signature! |
|
| Back to top |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Tue Apr 04, 2006 2:52 pm Post subject: |
|
|
Thanx, that worked if I change the 256 to the actual length of the file.
I can see how that is made variable by sample software. |
|
| Back to top |
|
 |
Gary13579
Joined: 15 Aug 2005 Posts: 93
|
Posted: Thu Apr 06, 2006 5:23 am Post subject: Re: Write to file? |
|
|
| Art wrote: | | Code: | void read_to_ram() {
int fd;
int cpa = 8; //defines the position of characters of interest
int cpb = 9; //
int cpc = 10; //
int cpd = 11; //
fd = sceIoOpen("flash0:/vsh/etc/version.txt", PSP_O_RDONLY, 0777);
sceIoRead(fd,data,256);
sceIoClose(fd);
printf(" PSP Unit Firmware Version Check: ");
printf("version ");
printf("%c",data[cpa]);
printf("%c",data[cpb]);
printf("%c",data[cpc]);
printf("%c",data[cpd]);
printf("\n");
int fdo;
fdo = sceIoOpen("ms0:/debug.txt", PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);
sceIoWrite(fd,"ms0:/version.txt", 256);
sceIoClose(fdo);
}
|
|
Umm.. why are you using version.txt? I haven't looked at the file much, but I believe the version number is stored in the index.dat file. Also, when writing to the file ms0:/debug.txt, you may want to try this
sceIoWrite(fdo, string, strlen(string)); |
|
| Back to top |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Thu Apr 06, 2006 12:58 pm Post subject: |
|
|
The real version number is there even when PSPset or any other program
has tricked the version.
My program makes sure it is running on 1.50 or it quits. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|