Code: Select all
#include "pg.h"
int xmain(void)
{
	unsigned long fc;
	unsigned long r,g,b,rgb;
	#define O_RDONLY	0x0001
	#define O_WRONLY	0x0002
	#define O_RDWR		0x0003
	#define O_NBLOCK	0x0010
	#define O_APPEND	0x0100
	#define O_CREAT		0x0200
	#define O_TRUNC		0x0400
	#define O_NOWAIT	0x8000
	
	pgInit();
	pgScreenFrame(2,0);
	pgFillvram(0);
	
	int inF, ouF;
        char line[512];
        int bytes;
 if((inF = sceIoOpen("ms0:/file1.txt", O_RDONLY)) == -1) {
    
    return(1);
  }
  if((ouF = sceIoOpen("ms0:/file2.txt", O_WRONLY | O_CREAT)) == -1) {
   
    return(1);
  }
while((bytes = sceIoRead(inF, line, sizeof(line))) > 0)
    sceIoWrite(ouF, line, bytes);
  sceIoClose(inF);
  sceIoClose(ouF);
	fc=0;
	while (1) {
		fc++;
		if (fc>=1536) fc=0;
		
		if (fc<256) {
			r=255;		g=0;		b=fc;
		} else if (fc<512) {
			r=511-fc;	g=0;		b=255;
		} else if (fc<768) {
			r=0;		g=fc-512;	b=255;
		} else if (fc<1024) {
			r=0;		g=255;		b=1023-fc;
		} else if (fc<1280) {
			r=fc-1024;	g=255;		b=0;
		} else {
			r=255;		g=1535-fc;	b=0;
		}
		r=r/8;
		g=g/8;
		b=b/8;
		rgb=(b<<10)+(g<<5)+(r<<0)+0x8000;
		pgPrint2(4,3,rgb,"Please Work!,");
		
		pgScreenFlipV();
	}
	return 0;
}
