Discuss the development of new homebrew software, tools and libraries.
Moderators: cheriff, TyRaNiD
-
jojojoris
- Posts: 255
- Joined: Sun Mar 30, 2008 4:06 am
Post
by jojojoris »
I have a problem when i use memset in my constructor.
This is my source:
Code: Select all
Image::Image(int Width,int Height) {
memset(data,0,Width*Height*sizeof(u32));
width=Width;
height=Height;
x=0;
y=0;
origx=0;
origy=0;
swizzled=0;
}
data is:
When i use gdb it said that it crashes by the memset function.
What do i wrong?
Code: Select all
int main(){
SetupCallbacks();
makeNiceGame();
sceKernelExitGame();
}
-
ps3fanboy
- Posts: 66
- Joined: Sun Jul 06, 2008 2:03 am
Post
by ps3fanboy »
data is a pointer and it looks like there is no memory allocated.
so, before you can use memset you have to malloc some memory to the pointer.
-
jbit
- Site Admin
- Posts: 293
- Joined: Sat May 28, 2005 3:11 am
- Location: København, Danmark
-
Contact:
Post
by jbit »
Learn C/C++, then code on PSP... These forums aren't for basic code questions, there are PLENNNTTTY of forums for that.
-
jojojoris
- Posts: 255
- Joined: Sun Mar 30, 2008 4:06 am
Post
by jojojoris »
jbit wrote:Learn C/C++, then code on PSP... These forums aren't for basic code questions, there are PLENNNTTTY of forums for that.
I know how to code c++ and this isn't my first thing op psp.
This is just the kind of mistake i often do. (use memset instead of malloc)
Code: Select all
int main(){
SetupCallbacks();
makeNiceGame();
sceKernelExitGame();
}