/* * call-seq: * get_name( n ) -> String * * Returns the name of nth joystick on the system, up to 1024 * characters long. The name is implementation-dependent. * See also #name(). */ VALUE rbgm_joy_getname( VALUE module, VALUE joynum ) { char *name; int n; int size=1024; name = (char *)malloc(size); n = snprintf(name,size,"%s",SDL_JoystickName(NUM2INT(joynum)));; return rb_str_new(name,n); }