Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!think!snorkelwacker!mintaka!ogicse!zephyr.ens.tek.com!tektronix!nosun!qiclab!m2xenix!puddle!p0.f4.n494.z5.fidonet.org!cspw.quagga From: cspw.quagga@p0.f4.n494.z5.fidonet.org (cspw quagga) Newsgroups: comp.lang.c Subject: How can I de-escape my strings at run time? Message-ID: <6550.26639B0A@puddle.fidonet.org> Date: 30 May 90 16:25:03 GMT Sender: ufgate@puddle.fidonet.org (newsout1.26) Organization: FidoNet node 5:494/4.0 - Settler City Fido, Grahamstown RSA Lines: 37 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@f4.n494.z5.fidonet.org Uninet: cspw@quagga uucp: ..uunet!m2xenix!quagga!cspw -- uucp: uunet!m2xenix!puddle!5!494!4.0!cspw.quagga Internet: cspw.quagga@p0.f4.n494.z5.fidonet.org