Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Sketchy

Game programming tutorial 5 question

This topic is 5891 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, In tutorial 5, SK has a LOG class, and, um, I''m not sure what the heck ... is and va_list, I can''t find any examples in the code where his variable arguments are used. Any help would be great.
  

bool LOG::
	Output(char* text, ...)
	{
	va_list arg_list;

	//Initialize variable argument list

	va_start(arg_list, text);

	//Open the log file for append

	if((logfile = fopen("Shining3D.log", "a+"))==NULL)
		return false;

	//Write the text and a newline

	vfprintf(logfile, text, arg_list);
	putc(''\n'', logfile);

	//Close the file

	fclose(logfile);
	va_end(arg_list);

	return true;
	}

  

Share this post


Link to post
Share on other sites
Advertisement
With the va stuff you can use the function like printf and sprintf. You can do stuff like this :

log.OUTPUT("the value is %i",some_value);

which is real handy if you wanna write the values of variables to the log file.





[edited by - George2 on June 30, 2002 3:48:21 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!