How can I de-escape my strings at run time?

cspw quagga cspw.quagga at p0.f4.n494.z5.fidonet.org
Thu May 31 02:25:03 AEST 1990


 
Is there an easy way to read a string into a buffer with automatic run-time
translation of the escape sequences?  I want to do something like this:
 
 { char fmt[100];
   gets(fmt);
      descape(fmt);   /*   ... This is the function I need   */
   printf(fmt,123);
   ...
 }
 
 The user should be able to enter his input data line like this
 
 \n\nThe value of \0x41 is %d\n
 
 and I'd like it to work as if the program contained the statement
 
  printf("\n\nThe value of \0x41 is %d\n",123);
 
(I can do it the hard way by parsing the string and substituting.  What
I want to know is whether there is a standard function or I/O routine
or a simple trick that can do the conversion at run time.)
 
Pete

--
EP Wentworth - Dept. of Computer Science - Rhodes University - Grahamstown.
Internet: cspw.quagga at f4.n494.z5.fidonet.org
Uninet: cspw at quagga
uucp: ..uunet!m2xenix!quagga!cspw



--  
uucp: uunet!m2xenix!puddle!5!494!4.0!cspw.quagga
Internet: cspw.quagga at p0.f4.n494.z5.fidonet.org



More information about the Comp.lang.c mailing list