www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/07/05/13:17:48

From: dontmailme AT iname DOT com (Steamer)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Newbie question about strings in C ..
Date: Wed, 05 Jul 2000 07:43:19 GMT
Organization: always disorganized
Lines: 29
Message-ID: <3962e704.1850632@news.freeserve.net>
References: <396119a7 DOT 31315113 AT news> <396230e0 DOT 2867154 AT news DOT wins DOT uva DOT nl> <jmk4ms45rh7sr4la5si05b5ccruaas0eeo AT 4ax DOT com>
NNTP-Posting-Host: modem-159.rhode-island.dialup.pol.co.uk
X-Trace: news7.svr.pol.co.uk 962783000 14285 62.137.90.159 (5 Jul 2000 07:43:20 GMT)
NNTP-Posting-Date: 5 Jul 2000 07:43:20 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Newsreader: Forte Free Agent 1.11/32.235
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Sean Proctor wrote:

> is there some way to find the maximum amount of input that gets or
> scanf will give. ie. in dos after you type for a while, if I remember
> right it was like two and a half lines, it wouldn't let you type
> anymore...

But you can do

    myprog < one-gigabyte_file_with_only_one_line

> is there a way using the standard libraries to find this limit?

No.  There isn't even a standard way to check that stdin isn't
coming from a file.

> Or if not, is there a way to do it using things provided by
> DJGPP or under UNIX?

The POSIX function isatty() at least lets you check that stdin is
attached to a console.  In the case of MS-DOS this may imply a
limit of about 128, but I'm not sure this can't be circumvented,
and other DOS variants may have higher limits.  I'm pretty sure
that there's no useful limit at all under Linux (for example).

In any case, gets() exists only for compatibility with
pre-standard C.  You're not supposed to actually use it.

S.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019