Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!aplcen!uakari.primate.wisc.edu!brutus.cs.uiuc.edu!apple!voder!zok!wattres!steve From: steve@wattres.UUCP (Steve Watt) Newsgroups: comp.lang.c Subject: Re: Novic C programmer needs help Message-ID: <420@wattres.UUCP> Date: 13 Feb 90 08:36:06 GMT References: <1153@psc90.UUCP+ <1990Feb12.201406.215@wam.umd.edu> Reply-To: steve@wattres.UUCP (Steve Watt) Organization: Steven Watt, Consultant Lines: 51 In article <1990Feb12.201406.215@wam.umd.edu+ dkim@wam.umd.edu (Daeshik Kim) writes: + In article <1153@psc90.UUCP> pyr201@.UUCP (d^2) writes: ++ char *form (va_alist) [ strange header ] ++ FILE b; + + Why isn't this "File *b;" ? I believe this is because the FILE structure is being used to fake out the putchar's that are called in doprnt. + ++ va_start (pvar); ++ fmt_string = va_arg (pvar, char*); ++ ++ b._flag = _IOWRT|_IOSTRG; ++ b._ptr = result; ++ b._cnt = LINELEN; ++ ++---> _doprnt(fmt_string, pvar, &b); <--- + File b seems to be opended here. File b is actually "opened" where b._flag =... happens. The thing that this code is interested in is that b._ptr = result, the buffer to put the result from doprnt into. ++ putc('\0', &b); /* Put a null terminator on result */ ++ ++ va_end (pvar); ++ return (result); ++} + + Where File b is closed? + What is this file? + I have not seen the whole program but either '_doprnt()' does + something wrong or file 'b' better to be closed with 'fclose()'. + Just an opinion! +-- + Daeshik Kim H: (301) 445-0475/2147 O: (703) 689-5878 + SCHOOL: dkim@wam.umd.edu, dskim@eng.umd.edu, mz518@umd5.umd.edu + WORK: dkim@daffy.uu.net (uunet!daffy!dkim) #if defined(FLAME) && FLAME >= 0 The entire piece of code, however, is *awful*!!!!!! If there is a varargs package around, there tends to be a vsprintf around! vsprintf is the very correct way of doing this sort of thing. Depending on having _doprnt around is NOT NICE! #endif -- Steve Watt ...!claris!wattres!steve wattres!steve@claris.com is reported to work. Is rm -rf a way to remove high-frequence noise? (No names mentioned! :-)