From owner-freebsd-questions@FreeBSD.ORG Fri Nov 26 00:45:43 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8CEA816A4CE for ; Fri, 26 Nov 2004 00:45:43 +0000 (GMT) Received: from ms-smtp-02.nyroc.rr.com (ms-smtp-02.nyroc.rr.com [24.24.2.56]) by mx1.FreeBSD.org (Postfix) with ESMTP id 11A6C43D46 for ; Fri, 26 Nov 2004 00:45:43 +0000 (GMT) (envelope-from BCSFD204@twcny.rr.com) Received: from twcny.rr.com (syr-24-59-136-53.twcny.rr.com [24.59.136.53]) iAQ0jeYn014742 for ; Thu, 25 Nov 2004 19:45:40 -0500 (EST) Message-ID: <41A67AF2.1060803@twcny.rr.com> Date: Thu, 25 Nov 2004 19:38:10 -0500 From: Tom Parquette User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6) Gecko/20040511 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "freebsd-questions@freebsd.org" Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Symantec AntiVirus Scan Engine Subject: OT: Trying to learn C -- some questions X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Nov 2004 00:45:43 -0000 Hi. This is a little off topic but I'm hoping someone can provide some guidance and answer a few questions. TIA. I'm trying to learn ANSI C using a book circa 1994. It is written from a DOS perspective. Someone at work, who knows a little C, told me that the book was "close enough". I'm having some trouble with some of the "homework" in the book. I think I know some of the answers but I would like to confirm my understanding. Some of the following I have no clue about. 1) gcc complains that was not found. If I comment out the #include, the program compiles. Is this a DOSism or something else? 2) fprintf is described with stdprn being valid for a default printer. This does not seem to be valid in, at least, the FreeBSD world. man fprintf did not really help. I believe I have to create a stream for the print but I'm not clear on how to do it. 3) gets() is used in a number of places. Using this gets me: /var/tmp//cciWrf9n.o(.text+0x20d): In function `get_data': : warning: warning: this program uses gets(), which is unsafe. I looked at the man page and found fgets. I do not understand from the fgets man page how I'm supposed to code this. I've tried a number of things along the lines of fgets(rec.fname,sizeof(rec.fname)); but gcc does not like anything I've tried. It keeps telling me I have "too few arguments fo function `fgets'" Help! 4) A couple of the home work assignments use getch(). I figured out from the getch man page that I needed "#include " but that changes the errors to: /var/tmp//cc1GEzyG.o(.text+0x6a): In function `main': : undefined reference to `stdscr' /var/tmp//cc1GEzyG.o(.text+0x6f): In function `main': : undefined reference to `wgetch' I do not know what header file I should be including. Or is there something else I'm not understanding? Thanks...