I will show the percentage when a file is copying in this function:
int fileCopy(char* inSrc , char* inDest) {
     SceUID tempSrc = sceIoOpen(inSrc, PSP_O_RDONLY, 0777);
     if(!tempSrc){
          printf("Error...\n");
          }
     SceUID tempDest = sceIoOpen(inDest, PSP_O_WRONLY | PSP_O_CREAT, 0777);
     if(!tempDest) {
          sceIoClose(tempSrc);
          printf("Error...\n");
     }
     char tempData[1024];
     int tempRead = sceIoRead(tempSrc, tempData, 1024);
     int tempWritten;
     while(tempRead > 0) {
               tempWritten = sceIoWrite(tempDest, tempData, tempRead);
               if(tempWritten != tempRead) {
               sceIoClose(tempDest);
               sceIoClose(tempSrc);
               sceIoRemove(inDest);
          printf("Error...\n");
          }
          tempRead = sceIoRead(tempSrc, tempData, 1024);
     }
     sceIoClose(tempDest);
     sceIoClose(tempSrc);
     return 1;
}
Have someone a solution?
Or how to get the file lenght?
I'll make a comparison between the read file and the file in writing to get
the current progress, it's possible?
			
			
													[SOLVED]Percentage when copy a file...
[SOLVED]Percentage when copy a file...
					Last edited by ne0h on Mon Mar 17, 2008 3:18 am, edited 1 time in total.
									
			
									
						Re: Percentage when copy a file...
Hi! :)
or move to 0 bytes from the end of the file:
Ciaooo
Sakya
			
			
									
									
						You can use stat:ne0h wrote:Or how to get the file lenght?
Code: Select all
#include <sys/stat.h>
struct stat stbuf;
if(stat(fileName, &stbuf) == -1)
   return -1;
fileSize = stbuf.st_size;Code: Select all
fd = sceIoOpen(filename, PSP_O_RDONLY, 0777);
if (fd < 0)
   return -1;
fileSize = sceIoLseek32(fd, 0, PSP_SEEK_END);
sceIoLseek32(fd, 0, PSP_SEEK_SET);Sakya