problem with my sceIoOpen code...

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
TheSamuraiElephant
Posts: 17
Joined: Thu Aug 04, 2005 9:10 pm

problem with my sceIoOpen code...

Post by TheSamuraiElephant »

I'm getting the error "passing argument 2 of 'sceIoRead' makes pointer from integer without a cast" back from cygwin about the following bit of code:

Code: Select all

	//open file and start reading
	fdin = sceIoOpen(filename, PSP_O_RDONLY, 0777);
	if(fdin >= 0)
	{
		printf("File opened %s\n", filename);
		char ID[2];
		unsigned int chunksize = 1;
		int bytes_read = 1;
		bytes_read = sceIoRead(fdin, ID, sizeof(ID));
		printf("Number of read bytes: %i\n", bytes_read);
		printf("ID: %s\n", ID);
		bytes_read = sceIoRead(fdin, chunksize, sizeof(chunksize));
		printf("Number of read bytes: %i\n", bytes_read);
		printf("ID: %i\n", chunksize);
	}
	else
	{
		printf("Couldn't open %s\n", filename);
	}
I basically just want to read 2 bytes into "ID" and display these 2 bytes as 2 char's and then read 4 bytes into "chunksize" and display as an integer.
I'm kind of a newbie, so apologies for asking such a newbie question.

Any help would be appreciated,
Cheers.
weltall
Posts: 310
Joined: Fri Feb 20, 2004 1:56 am
Contact:

Post by weltall »

it should work with a & before id in the line where is the sceioread.
the second argument of sceioread is a pointer
TheSamuraiElephant
Posts: 17
Joined: Thu Aug 04, 2005 9:10 pm

Post by TheSamuraiElephant »

cheers, that works fine now (both sceIoRead lines required changing).
Thanks! :)
Post Reply