Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Help adding strings and chars

Author
Message
Briere
19
Years of Service
User Offline
Joined: 28th Feb 2005
Location: Amherst New York, United States
Posted: 14th May 2006 19:17 Edited at: 14th May 2006 19:17
I need this for loop to work, so I can save my self typing out 300 lines of code! I keep getting this error.

C:\Documents and Settings\Owner\Desktop\Programming\insanecombat\dsdkmain.cpp(436) : error C2110: cannot add two pointers

Here is my code.


5/13/06- 787 lines into my 3D game engine! Player Movement and File System completed. Working on weapon inventory and player classes.
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 14th May 2006 20:33 Edited at: 14th May 2006 20:41
One way of doing it :

result=(char *) calloc(1,MAX_PATH+1);
for(int x = NUMSTART; x <= NUMEND; x++)
{
cNumAddress = dbStr(x-12);
strcpy(result,"2d/");
strcat(result,cNumAddress);
strcat(resule,".bmp");
dbLoadImage(result,x,1);
x++;
}
free(result);

Another way :

result=(char *) calloc(1,MAX_PATH+1);
for(int x = NUMSTART; x <= NUMEND; x++)
{
cNumAddress = dbStr(x-12);
sprintf(result,"2d/%s.bmp",cNumAddress);
dbLoadImage(result,x,1);
x++;
}
free(result);

Oh dear, the code aren't working

Web Site:http://www.nicholaskingsley.co.uk
Al:If we knew the unknown, the unknown wouldn't be unknown.
Briere
19
Years of Service
User Offline
Joined: 28th Feb 2005
Location: Amherst New York, United States
Posted: 14th May 2006 21:26 Edited at: 14th May 2006 21:27
I found something else to do instead of what I was going to do, its actualy more practical too

what does free do?
Free the memory that was holding the variable?

5/14/06- 1298 lines into my 3D game engine! Player Movement and File System completed. Working on weapon inventory and player classes.
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 14th May 2006 22:09
It frees the allocated memory

Web Site:http://www.nicholaskingsley.co.uk
Al:If we knew the unknown, the unknown wouldn't be unknown.

Login to post a reply

Server time is: 2024-11-19 06:33:44
Your offset time is: 2024-11-19 06:33:44