Return-Path: william@bourbon.usc.edu Delivery-Date: Mon Nov 24 23:17:25 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from bourbon.usc.edu (bourbon.usc.edu [128.125.9.75]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id mAP7HPEo007955 for ; Mon, 24 Nov 2008 23:17:25 -0800 Received: from bourbon.usc.edu (localhost.localdomain [127.0.0.1]) by bourbon.usc.edu (8.14.2/8.14.1) with ESMTP id mAP7FwS3002489 for ; Mon, 24 Nov 2008 23:15:58 -0800 Message-Id: <200811250715.mAP7FwS3002489@bourbon.usc.edu> To: cs551@merlot.usc.edu Subject: Re: CS551: Final Project 2 : Reading Commandline Date: Mon, 24 Nov 2008 23:15:58 -0800 From: Bill Cheng Someone wrote: > For printing the "servant:10000>" at prompt we have used puts and then a > select call to check for any input at the prompt. however, puts appends a > '\n' at the end of every string it displays at the prompt so this is moving > the cursor on the second line for entering commands. Have you done "man puts"? It sounds like it's doing exactly what is advertised. > We tried printf, fputs, putchar and putc but displays due to all of these > are somehow getting suppressed if we use it with select. any ideas on what > can the possible error be ? > > This is how the code i described above looks: > > while(1) { > > printf("servant:%d> ",port); // we have puts currently which is working > at the same place. > .... > .... > select () call and things needed for that > if (timer expires) and (no input) > continue; > else > /* > processing logic > */ > } Have you tried calling fflush(stdout) right after the printf()? -- Bill Cheng // bill.cheng@usc.edu