i have this read code that reads the settings for info and saves that into variables
the problem however is that the opening of a file goes correctly but the actual reading not:
Code: Select all
// -----------------------------------------
//
// LoadSettings
//
// -----------------------------------------
	int LoadSettings(void){
		int fdout;
		int fd2;
		//char sTmpLetter[2];
		fdout = sceIoOpen("settings.txt", PSP_O_RDONLY, 0777);
		if(fdout < 0)
		{
			DebugPrint(1,1, "error opening SETTINGS.TXT :(");
			fdout = sceIoOpen("SETTINGS.TXT", PSP_O_RDONLY, 0777);
				if(fdout < 0)
				{
					DebugPrint(1,2, "error opening settings.txt :(");
				}
		}
		
		fd2 = sceIoRead(fdout, Settings, strlen(Settings));
		sprintf(sBuffer, "%i", fd2);
		if(fd2 <= 0)
		{	
			DebugPrint(1,3, "error bytes read error");
			DebugPrint(1,4, sBuffer);
			sceIoClose(fdout);
			sceGuTerm();
			sceKernelExitGame();
		}
		int a, i;
		int aLast, aTmp;
		aLast = 0;
		aTmp = 1;
		for (a=0;a<101;a++){
			if (Settings[a] == '*'){
				if (aTmp == 1) {
					sprintf(sBuffer, "0");
					for (i=aLast;i<a;i++){
						sprintf(sBuffer, "%s%c",sBuffer,Settings[i]);
					}
					iLeftRightSpeed = atoi(sBuffer);
					iLRSpeed = 5 + (iLeftRightSpeed *5);
					aLast = a+1;
					aTmp += 1;
				}
				else if (aTmp == 2) {
					sprintf(sBuffer, "0");
					for (i=aLast;i<a;i++){
						sprintf(sBuffer, "%s%c",sBuffer,Settings[i]);
					}
					iStatusSound = atoi(sBuffer);
					aLast = a+1;
					aTmp += 1;
				}
			}
		}
		return 0;
	}
fd2 has value 0
why is this?