Path: utzoo!utgpu!attcan!uunet!husc6!bbn!rochester!pt.cs.cmu.edu!speech1.cs.cmu.edu!phd From: phd@speech1.cs.cmu.edu (Paul Dietz) Newsgroups: comp.sys.mac.programmer Subject: Re: LSC 3.0 scanf deletes Keywords: delete, scanf Message-ID: <2575@pt.cs.cmu.edu> Date: 4 Aug 88 03:07:18 GMT References: <2559@pt.cs.cmu.edu> <587@helios.ee.lbl.gov> <5794@haddock.ISC.COM> Sender: netnews@pt.cs.cmu.edu Organization: Carnegie-Mellon University, CS/RI Lines: 36 I asked: >>>I'm tired of fighting this one. Does anybody know how to delete >>>characters when you make a mistake typing during an LSC scanf? Apparently, noboby condones the use of scanf: >>The answer to your question is, DON'T USE SCANF! >Thus, not only do I never use "scanf" or "fscanf", I seldom use "sscanf". SO: What do you use for input on your quick little pieces of code???? Since I move code freely back and forth between UNIX and the Mac, I'd like a solution which works equally well on both. My first idea was to fix the scanf routine in the LSC library to handle deletes properly. Unfortunately, this looked like a great deal of work. (Apparently, the routine does not buffer the input...) Next idea was to write a macro to replace scanf with the appropriate fgets and sscanf calls. This stumbled when I realized I didn't know how to write macros which took variable number of arguments. The last idea was to write my own general scanf replacement and use it everywhere, but this failed with my not knowing a machine independent way of moving the cursor and deleting characters. So, what should I do??? Help..... Thanks! Paul H. Dietz ____ ____ Dept. of Electrical and Computer Engineering / oo \ <_<\\\ Carnegie Mellon University /| \/ |\ \\ \\ -------------------------------------------- | | ( ) | | | ||\\ "If God had meant for penguins to fly, -->--<-- / / |\\\ / he would have given them wings." _________^__^_________/ / / \\\\-