Category : Files from Magazines
Archive   : CUJ9204.ZIP
Filename : 1004106A

 
Output of file : 1004106A contained in archive : CUJ9204.ZIP

Listing 1

**********
#include
#include
#include

void myfunction1(char *format, ...)
{
va_list arg_ptr;
va_start(arg_ptr,format);
vfprintf(stdout,format,arg_ptr);
va_end(arg_ptr);
}

void myfunction2(char *format, ...)
{
FILE *fp;
va_list arg_ptr;
fp = fopen("TEST.DAT","a+");
va_start(arg_ptr,format);
vfprintf(fp,format,arg_ptr);
va_end(arg_ptr);
fclose(fp);
}

void myfunction3(char *format, ...)
{
va_list arg_ptr1;
va_list arg_ptr2;
va_start(arg_ptr1,format);

myfunction1(format,arg_ptr1);

/* here I want to use the arguments of myfunction3(),
va_end(arg_ptr1); but this code does not work */

va_start(arg_ptr2,format);
myfunction2(format,arg_ptr2);

/* here I want to use the arguments of myfunction3(),
va_end(arg_ptr2); but this code does not work */
}

int main()
{
char msg[]="message";
myfunction1("\n%s=%d=%f", msg, 2, 3.0); /* this works fine */
myfunction2("\n%s=%d=%f", msg, 2, 3.0); /* this works fine */

/* the following call of myfunction3() does not work.
I want to have the same result, as
if I call myfunction1() and myfunction2() isolated */

myfunction3("\n%s=%d=%f", msg, 2, 3.0);
}

*************



  3 Responses to “Category : Files from Magazines
Archive   : CUJ9204.ZIP
Filename : 1004106A

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/