Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!ames!amdahl!oliveb!sun!gorodish!guy From: guy%gorodish@Sun.COM (Guy Harris) Newsgroups: comp.sources.bugs Subject: Re: uupc for MS-DOS problem Message-ID: <27324@sun.uucp> Date: Sat, 5-Sep-87 16:34:31 EDT Article-I.D.: sun.27324 Posted: Sat Sep 5 16:34:31 1987 Date-Received: Sun, 6-Sep-87 08:16:49 EDT References: <339@gsg.UUCP> Sender: news@sun.uucp Lines: 22 Keywords: uupc MS-DOS uucp comm As somebody pointed out, this code is correct; admittedly, you have to understand what "sscanf" does in order to understand it, but this is a perfectly reasonable requirement. > sscanf(name, "COM%d", &i); <---- why take the addr of i? Because if you don't, "scanf" will use the value of "i" as a pointer and stuff the result of the "sscanf" into the location this value points to. Remember, C is a call-by-value language, and the "scanf" routines *store* data retrieved *from* their input *into* variables. > select_port(i); <---- use i without knowing its content? No, use "i" after it has been given a value by the "sscanf" call. > sscanf(baud, "%d", &i); <---- addr of i becomes the baud rate?? No, the decimal value represented by the string in "baud" becomes the value of "i". RTFM. Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com