something like..FileRead(void *buffer, int numbytes,........

Login to reply to this topic.
Wed, 2004-11-24 19:40
Joined: 2004-11-24
Forum posts: 9
HI,
We are new on Symban Platform. We are porting a game on it.

We have this problem: we have all our game datas into Binary files and ascii files (txt files, used almost like Ini files and to build Menus).

We want to know how to Open a Binary file and Read Int, Boo, Floats from there.

Something like a FileRead(void *buffer, int numbytes, int *numbytesread)

We want to use classical C/C++ methods for Portability from one platform to another, but if we need to use Symbian Classes....
Thanks in advance,

Wed, 2004-11-24 20:51
Joined: 2004-07-10
Forum posts: 364
Re: something like..FileRead(void *buffer, int numbytes,....
Symbian support standard C functions, if you don't want to develop in symbian code use those instead
Wed, 2004-11-24 23:17
Joined: 2004-06-06
Forum posts: 205
something like..FileRead(void *buffer, int numbytes,........
you can to it like this

TPtr8 tmp( ( TUint8 * ) aBuffer, aBufLen, aBufMaxLen );
aFile->Read( tmp, aCount );

where aBuffer is your buffer, aBufLen is length of your buffer. in this case it should be 0, aBufMaxLen is a buffer size.
aFile is RFile
take care

Best regards,
Michal Laskowski

Thu, 2004-11-25 10:54
Joined: 2004-11-24
Forum posts: 9
something like..FileRead(void *buffer, int numbytes,........
Thanks a lot guys.
Just another question:

How to inizialize a TDesC8 with a char* contents?
Should we have to use another Type to inizialize it?
Thanks!!!
Thu, 2004-11-25 11:41
Joined: 2004-06-06
Forum posts: 205
something like..FileRead(void *buffer, int numbytes,........
what do you mean bout "initializing with char*"?

Best regards,
Michal Laskowski

Thu, 2004-11-25 21:36
Joined: 2004-11-21
Forum posts: 33
something like..FileRead(void *buffer, int numbytes,........
Quote from: twelvegames
Thanks a lot guys.
Just another question:

How to inizialize a TDesC8 with a char* contents?
Should we have to use another Type to inizialize it?
Thanks!!!

Depending on what you want/need:
Code:
void Foo( const char* aNullTerminatedStr)
{
   TBufC8<232> myBuf( aNullTerminatedStr); // This will copy
// or
   TPtrC8 myPtr( aNullTerminatedStr); // This will reference
//...
}

Regards, Bo

  • Login to reply to this topic.