Can ANYONE tell me why this code snippet doesn't work??
Vincent C. Hatem
vch at attibr.UUCP
Tue Oct 18 04:59:06 AEST 1988
In article <7778 at gryphon.CTS.COM%, rickf at pnet02.cts.com (Rick Flower) writes:
% I've been trying to get the following code to work.. I've tried just about
% everything that I could think of (along the lines of modifications). All I'm
% trying to do is write a different printf routine to route information through
% a window text printing routine... If anyone can help me, let me know..
%
% -----------------------------------------------------------------------------
% void Test(fmt,args)
% char *fmt;
% unsigned *args;
% {
% char buff[129];
%
% sprintf(buff,fmt,args);
% printf("%s\n",buff);
% }
%
% main()
% {
% Test("%d %d %d %d",10,20,30,40);
% }
You aren't passing a POINTER to the arguments, as you seem to think you are.
this should be (if I'm not mistaken... i haven't tried this lately)
unsigned *args;
sprintf(buff,fmt,&args);
^
!
-Vince
--
Vincent C. Hatem | att ---->\ (available from any
AT&T International | ulysses ->\ Action Central site)
International Operations Technical Support | bellcore ->\
1200 Mt Kemble Ave, Basking Ridge, NJ 07920 | ihnp4 ----->\__ !attibr!vch
More information about the Comp.lang.c
mailing list