|
-
May 1st, 2007, 06:45 PM
#1
Pointers and "explode" function
1. I'm making a level editor for my game, so I have a .txt like this
Layer 1
Line 1 0,0,47,43,1,0,0,0,38,... (64 tiles)
Line 2... (64 lines)
Layer 2
... (64x64)
Layer 3
... (64x64)
On PHP I could use commands like explode(), is there a similar command for C++? I need so I can get the separate values for each comma, thanks again!
2. Returning an array, am I doing something wrong?
Code:
//inside class CLevel;
int *getCamera()
{
int camera[2];
camera[0] = 40;
camera[1] = 40;
return camera;
}
//on int main
CLevel *levelCommands;
levelCommands = new CLevel;
int *camera;
camera = levelCommands->getCamera();
camera[0] returns me like a huge int and camera[1] returns me -1... doesn't make any sense. :P
Thanks guys!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|