is their anything in the c library like this..

Programming, for all ages and all languages.
Post Reply
earlz

is their anything in the c library like this..

Post by earlz »

Is their anything in the standard C library that lets you do somethign like.. getstuff("hello type a string: %s\n type soem hex 0x%x \nand at last type a number: %i",string,&hex,&dec);
and it be like gets and such but act like printf
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:is their anything in the c library like this..

Post by Candy »

scanf
earlz

Re:is their anything in the c library like this..

Post by earlz »

no like this is what I want..

Code: Select all

getf("type your number: %s",num);

rather than
printf("type your number: ");
scanf("%s",num);
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:is their anything in the c library like this..

Post by Candy »

Jordan3 wrote: no like this is what I want..

Code: Select all

getf("type your number: %s",num);

rather than
printf("type your number: ");
scanf("%s",num);
How is that code supposed to know what is input and what is output? The point of printf is that it's all output, scanf is all input. You can't practically make a mix between them without assuming a number of things that make a lot of applications impossible.
dc0d32

Re:is their anything in the c library like this..

Post by dc0d32 »

can we have a new escape sequence? Or ASCII?
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:is their anything in the c library like this..

Post by Solar »

In your own OS API library, you can implement whatever you like. Standard C is defined by the standard document, and doesn't know mixed input / output or "other escape sequences".
Every good solution is obvious once you've found it.
Post Reply