-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1On Tuesday 16 September 2003 16:58, Goul_duKat wrote:
void SDL_WM_GetCaption (char **title, char **icon)
{
SDL_VideoDevice *video = current_video;
if ( video ) {
if ( title ) {
*title = video->wm_title;
}
if ( icon ) {
*icon = video->wm_icon;
}
}
}
instead of this ???
void SDL_WM_GetCaption (char *title, char *icon)
{
if ( current_video) {
title = current_video->wm_title;
icon = current_video->wm_icon;
}
}
The video vs. current_video shouldn’t make a difference.
However, you apparently don’t understand C pointers, strings and arguments
enough.
When the parameters of a function are modified within a function call, the
caller of the function will not know. So if you’ve got something like this:
void foo(int a)
{
a++;
printf("%i\n", a);
}
int main(int argc, char** argv)
{
int a = 4;
foo(a);
printf("%i\n", a);
return 0;
}
the output will be:
5
4
This is why your suggested change will not work.
Note that in the version that SDL uses now, the parameters title and icon
themselves are not changed, but the memory that they point to is changed.
If you changed my example above in a way that foo() takes a pointer to int
instead of an int, the output would be 5\n5\n.
cu,
Nicolai
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQE/Zy3nsxPozBga0lwRAv6TAJ9BgLK9C+aUipOQmjn0sNpa+4MjowCeMjUx
ReZJt8YoLuqH8FWXm8Bx7PE=
=LJFh
-----END PGP SIGNATURE-----