By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,471 Members | 711 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,471 IT Pros & Developers. It's quick & easy.

can we use such function to display input without using "Prinf" ?

P: n/a
hi!
can we use any function to display our input

without using a " printf " function? does c support such this
possibilities?
...

Nov 20 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
va*****@gmail.com wrote:
hi!
can we use any function to display our input

without using a " printf " function? does c support such this
possibilities?
..
Yes. Use the standard fprintf(), vprintf(), vfprintf(), puts(),
fputs(), putchar(), putc(), fputc(), or write your own.

Nov 20 '06 #2

P: n/a
Rg
On Nov 20, 11:23 am, "varo...@gmail.com" <varo...@gmail.comwrote:
hi!
can we use any function to display our input
without using a " printf " function? does c support such this
possibilities?
..
Standard C includes puts, fprintf, fputs, putchar and fputc which can
be used to print text into stdout or other specifi file streams.

Rg

Nov 20 '06 #3

P: n/a

santosh wrote:
>
Yes. Use the standard fprintf(), vprintf(), vfprintf(), puts(),
fputs(), putchar(), putc(), fputc(), or write your own.
could you show me an example using
your own function?

Nov 20 '06 #4

P: n/a
Je-Givara wrote:
santosh wrote:

Yes. Use the standard fprintf(), vprintf(), vfprintf(), puts(),
fputs(), putchar(), putc(), fputc(), or write your own.

could you show me an example using
your own function?
As such custom functions are usually very platform specific, it would
not be topical for this group. However, if you _really_ want to see
such code, try asking Mr. Navia nicely. He's in a very OT mood right
now. :-)

Nov 20 '06 #5

P: n/a
va*****@gmail.com wrote
hi!
can we use any function to display our input

without using a " printf " function? does c support such this
possibilities?
Yes, as many people know this topic is covered in detail in The C
Programming Language (2nd Edition) by Brian W. Kernighan, and Dennis
Ritchie, there is an example in the book and they explain how this
accomplished using a function.

Neil

Nov 21 '06 #6

P: n/a

void minprintf (char *fmt, ... )
{
va_list ap;
char *p, *sval;
int ival;
double dval;
va_start (ap, fmt);
for(p=fmt; *p;p++)
{
if (*p != '%')
{
putchar (*p);
continue;
}
switch (*++p)
{
case 'd': ival = va_arg(ap,int);
printf("%d",ival);
break;
case 'f': dval = va_arg (ap, double);
printf("%f",dval);
break;
case 's': for (sval = va_arg(ap,char *);*sval;sval++)
putchar (*sval);
break;
default: putchar(*p);
break;
}
}
va_end(ap);
}

void main()
{
.....
}

so this a code and what shall we write in the Main program?

Dec 1 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.