HDTenEightyP/NetNews huggingface dataset:
From: steve@taumet.com (Steve Clamage)
Subject: Re: Help!!! Please Read this message!?!?!?!?!...
Organization: TauMetric Corporation
Date: Fri, 11 Sep 1992 17:02:37 GMT

mjn@pseudo.uucp (Murray Nesbitt) writes:

|wilson@rhombus.cs.jhu.edu (Dwight Wilson) writes:

|>Huh?  "%f" specifies a double not a float.  If you think about the
|>promotion rule you'll realize that specifying a float would be
|>nonsensical since it is not possible for an argument to printf()
|>to be passed as a float!  

|    printf( "%f...%s?\n", (float)f, "Huh?" );

|It's another matter whether you'd *want* to pass a float to printf(),
|but it is possible.

It depends on what you mean by "pass" a float.  The above code
requests that a float be passed to printf, but printf nevertheless
receives a double.  This is due to the promotion rules as Wilson
correctly noted.  The sample code converts 'f' to a float, then
promotes that float value to a double and passes it to printf.
-- 

Steve Clamage, TauMetric Corp, steve@taumet.com
Vice Chair, ANSI C++ Committee, X3J16
Newsgroups: comp.lang.c
From: rickan@maccs.dcss.mcmaster.ca (Mark Rickan)
Subject: Re: Initializing Random Seeds 
Organization: Department of Computer Science, McMaster University
Date: Sat, 5 Sep 1992 16:59:49 GMT

In article <hawkeye.715690233@glia> hawkeye@glia.biostr.washington.edu
(Ken Keys - TF Dude) writes:

>One commonly used seed on UNIX systems is time(NULL) + getpid().
>By the way, why do you feel the need to seed the generator more than once?

I'm actually running the process on demand, which makes it necessary
to introduce a new random seed. Unfortunately, there is a remote possibility
that the user could keep up the system on a fast machine (this is more
for 'dummy-proofing' than accuracy). The program will ultimately be
system-specific and GUI-based (you'd have to have pretty fast reflexes!),
so I may simply determine the process ID or time in milliseconds for
added assurance.

Cheers,

Mark

-- 
 -------------------------------------------------------------------------
 = Mark Rickan                         ...!uunet!utai!utgpu!maccs!rickan = 
 = DCSS, McMaster University               rickan@maccs.dcss.mcmaster.ca = 
 -------------------------------------------------------------------------
From: nadeau@JSP.UMontreal.CA (Nadeau Jean-Claude)
Newsgroups: comp.lang.c
Subject: Re: Dropping a n from a fprintf()
Date: 15 Sep 92 15:28:57 GMT
Organization: Universite de Montreal

In article <1992Sep11.052108.26159@ra.msstate.edu> cee1@ra.msstate.edu (Charles Evans) writes:
>Ok here is the deal.
>
>Reading in from a textfile with one string per line (variable length, but
>none _too_ long) Then I want to add some strings on either side of the
>read in string and rewrite the new string to a new file line by line. But
>there are some probs.. here is what I have:
>
>	FILE *fp1, *fp2; 
>	char *item;         /* also tried stuff like char item[20];,
>				same results */
>
>....
>
>	while ((fgets(fp1,20,item)) != 0)
>	{
>		fprintf(fp2,"I found a %s in my pocket\n", item);
>	}
>...
>
>Ok here is the deal. fgets reads at most 20-1 characters or up to a
>newline.. and if it reaches a newline it adds that to the string along with
>the \0.. So if on the first line of reading in (from fp1) it had "chicken"
>the string in fprintf would be:
>
	... etc ...

	If you're sure that the lines are shorter than 20-1 characters
	(including the \n) you can use this short statement:

		item[ strlen(item) - 1 ] = '\0';
-- 
Jean-Claude Nadeau, ing.	<nadeau@JSP.UMontreal.CA>
Services informatiques		<nadeau@ERE.UMontreal.CA>
Universite de Montreal		<nadeau@UMTLVR.BITNET>
Tel. (514) 343-6111,ext 5234	Fax  (514) 343-2155
Newsgroups: comp.lang.c
From: alpha@waggen.twuug.com (Joe Wright)
Subject: Re: Help! what's wrong with this program?
Organization: ALPHA, Box 68621, Va. Beach, VA 23455
X-Newsreader: Tin 1.1 PL3
Distribution: usa
Date: Wed, 9 Sep 1992 22:35:52 GMT

swalter@nyx.cs.du.edu (DreamWeaver) writes:
: 
: Correct me if I'm wrong (lord knows that will happen ;) ... but doesn't
: the line
: 
:    *bp++ = c;
: 
: in the pusch() function actually mean (as far as order of precedence):
: 
:    (*bp)++ = c;
: 
: and not (what you want or think):
: 
:    *(bp++) = c;
: 
: Call me kooky ...
: 
: -Scotty
: 
Hi kooky.  Yes, you got it backward.  *p++ returns the value pointed
to by p and then increments p.  (*p)++ returns the value pointed to
and then increments the value pointed to.  K&R1 s5.1 p89.

-- 
Joe Wright  alpha@waggen.twuug.com  alpha@wyvern.twuug.com
Newsgroups: comp.lang.c
From: chris@chinook.atd.ucar.edu (Chris Webster)
Subject: fopen & binary mode
Reply-To: chris@chinook.atd.ucar.edu
Organization: Research Aviation Facility, NCAR, Boulder, CO
Date: Wed, 9 Sep 1992 15:23:25 GMT


When I used to program with Borland C on PC's, the fopen call
had binary mode.  This was accomplished by placing a 'b' after
the mode (e.g. "r+b").  This prevented CR from being converted
into CR/LF or something of the sort.

My question is:  Does this apply to most installations of the
C library?  Was it just a DOSism?  Should I continue to use it
so my code is more portable?  The Sun compiler has not complained
about me doing so.

If this is not the appropriate news group please let me know of a
better one.  Thanx.

--Chris
From: mike@pacsoft.com (Mike Stefanik)
Newsgroups: comp.lang.c
Subject: Re: People's Experience with C Debuggers
Keywords: C debugger experience gdb dbx
Date: 10 Sep 92 02:30:14 GMT
Organization: Pacific Software Group, Riverside, Ca.

In an article, bandy@aplcen.apl.jhu.edu (Mike Bandy) writes:
>I'm spoiled - I grew up with VMS.  All those UNIX debuggers are crap compared
>with the VMS symbolic debugger (under any language). [...]

Uh-oh... do I smell smoke? :-)

-- 
Mike Stefanik  mike@pacsoft.com  ...!uunet!pacsoft!mike
Pacific Software Group, Riverside, CA
Newsgroups: comp.lang.c
From: jameel@bourbon.ee.tulane.edu (Akhtar Jameel)
Subject: 2D FFT NUMERIC RECIPES.
Nntp-Posting-Host-[nntpd-5176]: bourbon
Organization: Computer Science Dept., Tulane Univ., New Orleans, LA
Date: Wed, 16 Sep 1992 04:21:52 GMT


could anybody please mail me a copy of fast fourier transform for
two dimensions in C. thanks in advance.

jameel@rex.cs.tulane.edu


Newsgroups: comp.lang.c
From: foxd@silver.ucs.indiana.edu (daniel fox)
Subject: getting characters
Organization: Indiana University
Date: Thu, 10 Sep 1992 21:29:36 GMT


I would like to know what function call would enable me to get characters one
at a time from the keyboard.  I have tried getc, scanf, etc, and keep running
into the same problem.  The functions keep sitting there and waiting for a 
return before allowing the program to proceed any further.  HELP!!!

                                      Daniel B. Fox
                                      KF9ET
.standard disclaimer

Xref: sparky comp.lang.c:13302 comp.std.c:2582
From: torek@horse.ee.lbl.gov (Chris Torek)
Newsgroups: comp.lang.c,comp.std.c
Subject: Re: strcpy implementation question
Date: 7 Sep 92 18:53:31 GMT
Reply-To: torek@horse.ee.lbl.gov (Chris Torek)
Organization: Lawrence Berkeley Laboratory, Berkeley
NNTP-Posting-Host: 128.3.112.15

In article <MJN.92Sep7022836@pseudo.uucp> mjn@pseudo.uucp
(Murray Nesbitt) writes:
>Wouldn't this program [that uses strcpy()] need to #include <string.h>
>(or at least have a declaration for strcpy()) for strict conformance?

Yes; but there is more to this than might first appear.

I was wrong when I claimed earlier that the SunOS cc bug-finding
program needed to `#include <stdio.h>' in order to use puts().  The
situation here is somewhat complicated.  As Mark Brader reminded me,
section 4.1.6 of the ANSI C standard (7.1.7 in the ISO standard) allows
implicit declarations of library functions if the implicit declaration
is the same as the Standard's explicit declaration.  Thus, given a
Standard function of the form:

	return-type name ( argument-list ) ;

a call that provides an implicit declaration provides a correct declaration
if and only if:

	a) the return-type is int;
	b) the various types making up the argument-list are all
	   `normal' C types and none are `shorter' types that
	   undergo default promotions; and
	c) the argument-list does not end with `, ...'.

This means that you can use functions like `puts' and `strlen' without
declaring them and without including the appropriate header, but you
cannot use functions like printf()---which returns int but uses `, ...'
---or strcpy(), which returns `char *', without a previous declaration.

Note that this is going to both comp.std.c and comp.lang.c.  In this
particular case, a simple

	char *strcpy();

suffices for strict conformance (comp.std.c answer).  However, as a
general rule, one should always #include the appropriate header
(comp.lang.c answer)---you are far less likely to get into trouble, and
you will probably get better error diagnostics, etc., etc.
-- 
In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 510 486 5427)
Berkeley, CA		Domain:	torek@ee.lbl.gov
From: shrchin@csug.cs.reading.ac.uk (Jonathan H. N. Chin)
Newsgroups: comp.lang.c
Subject: Re: 1992 International Obfuscated C Code Contest winners
Date: 12 Sep 92 04:09:15 GMT
Organization: University of Reading

barmar@think.com (Barry Margolin) says:
>In article <268@talgras.UUCP> david@talgras.UUCP (David Hoopes) writes:
>>In article <1992Sep10.135002.25527@wraxall.inmos.co.uk> nathan@elberton (Nathan Sidwell) writes:
>>>Landon C. Noll (chongo@hoptoad.uucp) wrote:
>>>As chongo stated, my entry can't be posted from the USA.
>>Why couldn't your program be posted from the U.S?
>
>I haven't examined it, but I'll bet if you figure out what it does, you'll
>realize that posting it from the US and allowing it to propogate outside
>the US would be a violation of export control laws regarding munitions.

So what happens now that it has (I assume) entered the US via news?
Does every US news admin whose system it passes through have to delete it
to prevent it leaving the US again?

Jonathan
-- 
Jonathan H N Chin (9 kyu) \ Dept. of Cybernetics, \ "Respondeo, etsi mutabor"
shrchin@uk.ac.rdg.susssys1 \ University of Reading \
bq305@cleveland.freenet.edu \ Box 225, Whiteknights \ < Rosenstock-Huessy >
jockstrap,mandy@CyberSpaceII \ Reading, RG6 2AY, U K \
Newsgroups: comp.lang.c
From: steve@taumet.com (Steve Clamage)
Subject: Re: File Handling
Organization: TauMetric Corporation
Date: Fri, 11 Sep 1992 16:50:20 GMT

roy%cybrspc@cs.umn.edu (Roy M. Silvernail) writes:

>So I can get a file position with fgetpos() and restore it with
>fsetpos().  Somehow, this seems to lack utility to me.  The vast
>majority of file positioning I do is related to locating data within the
>file, for which I must calculate a position.  It doesn't appear that
>fsetpos() is useful for that purpose.  So, why use it at all?

You are assuming that it is valid to do arithmetic on a file position.
This is not always the case, particularly with text files.

The fgetpos and fsetpos functions let you write portable code.  Once
you have found a position in a file you can get back to it again.
On a particular system you might get away with going to the Nth
byte before or beyond some file position, but you might get various
failures or unexpected results on another system.

Let's take a trivial example, omitting all the error checking:
	fpos_t p;
	int c;
	FILE *file;
	...
	fgetpos(file, &p);
	fprintf(file, "Hello\nWorld\n");
	fsetpos(file, &p);

Now the file is at the position of the 'H' (guaranteed for all systems).
Suppose we now seek forward 6 bytes and get a character.
	fseek(file, 6L, SEEK_CUR);
	c = fgetc(file);

What is the value in c?  Is it 'W'?  On a Unix system, yes.  On an
MSDOS system, it might be the LF before the 'W', but who knows?
It depends on how fseek was implemented for text files.  On other
systems which use record-oriented text files, the seek might or might
not be legal, and there is no telling what c contains.

Even binary files may have the same sort of problems in a record-
oriented file system.

Finally, the integral type used for seek functions might be inadequate
for very large files on some systems.  For record-oriented file systems
it may be almost useless.  The fpos_t type will (or should) be a type
suitable for encoding any position in any kind of file.

In case the last paragraph isn't clear:  Some systems allow files
larger than 4 gigabytes.  You can't record all possible file positions
in a 32-bit integer.  For a record-oriented file system, you would need
to encode the record number and the offset within the record.  You will
thus have a limit on the record size or the number of records (or both)
which will be too small for some programs.
-- 

Steve Clamage, TauMetric Corp, steve@taumet.com
Vice Chair, ANSI C++ Committee, X3J16
From: jerry@synopsys.com (Jerry Huth)
Newsgroups: comp.lang.c
Subject: Re: pointer to multi D array   and   Why should POINTERS be so hard?
Date: 3 Sep 92 11:21:50 GMT
Organization: Synopsys Inc.


>> Make that:
>> 
>>    int A[5][5]={1,2,3,.....}, *x;
>> 
>> Then this will work:
>> 
>>    x=A;
>> 
>> ...
>> 
>> Well, if you instead defined:
>> 
>>   int dummy1[5] = {...};
>>   int dummy2[5] = {...};
>>   int dummy3[5] = {...};
>>   int dummy4[5] = {...};
>>   int dummy5[5] = {...};
>>   int *A[5] = {dummy1, dummy2, dummy3, dummy4, dummy5 };
>> 
>> then you would have the "desired" effect, and then also can you define 
>> x like:
>> 
>>   int **x=A;

Which raises the question:  Why does C have these two different ways to
implement arrays?  

It's because the first version is the most efficient way to implement
constant-size arrays (i.e. the size of the array is known at compile
time), but the second version is the most efficient way to implement
dynamicly-allocated arrays.



On another topic:

>    for (_i=a;  _i<a+1000; _i++ )
>       *_i = get_some_arbitrary_value();
>
>[This] version would not be possible unless you had pointers that
>knew what type they were supposed to point to, and thus know how many
>bytes to increment the address to get to next guy.

vs.

>That's not true.  If pointers didn't scale automatically, the programmer
>would do it himself:
>    for (_i=(char *)a; _i<a+1000*sizeof(int); _i+=sizeof(int))
>       *(int *)_i = whatever();

This first guy is correct; the whole point is that the programmer
DOESN'T WANT to scale it himself.  Of course, C is completely
flexible: if you want to declare all your pointers as generic pointers
and do all the math yourself, by all means go right ahead.  But why
would you anyone want to?



jerry@synopsys.com
From: wkaufman@us.oracle.com (William Kaufman)
Newsgroups: comp.lang.c
Subject: Re: dynamic multidimensions qtn ?
Keywords: pointers 2 dimensions
Date: 12 Sep 92 01:50:28 GMT
Organization: Oracle Corporation, Redwood Shores CA
X-Disclaimer: This message was written by an unauthenticated user
              at Oracle Corporation.  The opinions expressed are those
              of the user and not necessarily those of Oracle.

In article <simon.716185168@giaeb> simon@giaec.cc.monash.edu.au (simon shields) writes:
] 
] 	int **f;

    This is an array of pointers; f[n] (for some n) is a pointer to an
int or list of ints.

] 	if ((f=(int**) malloc(100*sizeof(int)))==NULL) {
] 		error("Not enough memory for f\n");
] 		exit(0);
] 	}

    OK, so at this point, the array of pointers has been allocated.
But, what is f[0]?  Well, it's a pointer to an int or list of ints.
But, it's a pointer that hasn't been initialized!

    What you want to do is allocate the pointers in the array, like

        int i;

        for (i = 0; i < 100; i++)
            if ((f[i] = (int *)malloc(SOMETHING * sizeof(int)))
                                == NULL)
              {
                error("Not enough memory for f[X]\n");
                exit(0);
              }

                                           -- Bill K.

Bill Kaufman               |  `` Guess I'm gonna have to tell 'em,
wkaufman@us.oracle.com     |     That I've got no cerebellum.        ''
                           |              -- "Teenage Lobotomy", The Ramones
Newsgroups: comp.lang.c
From: lezz@merlin.dev.cdx.mot.com (Lezz Giles)
Subject: Re: SEX SEX SEX
Reply-To: lezz@merlin.dev.cdx.mot.com (Lezz Giles)
Organization: Motorola Codex, Canton, MA
Distribution: usa
Date: Mon, 7 Sep 1992 14:49:56 GMT

In article <1992Sep5.012630.24416@kpc.com>, hollasch@kpc.com (Steve Hollasch) writes:
|>Newsgroups: comp.lang.c
|>Path: merlin.dev.cdx.mot.com!isunix.cdx.mot.com!mothost!ftpbox!uunet!wupost!sdd.hp.com!spool.mu.edu!darwin.sura.net!sgiblab!news.kpc.com!kpc!hollasch
|>From: hollasch@kpc.com (Steve Hollasch)
|>Subject: Re: SEX SEX SEX
|>Message-ID: <1992Sep5.012630.24416@kpc.com>
|>Summary: Damn newbies...
|>Sender: usenet@kpc.com
|>Organization: Kubota Pacific Computer, Inc.
|>References: <Bu29wr.C4o@wpi.WPI.EDU>
|>Distribution: usa
|>Date: Fri, 4 Sep 92 21:26:30 GMT-0:08
|>Lines: 9
|>
|>vinod@dolomite.WPI.EDU (Vinod K Nair) writes:
|>    [drivel that DESERVED to be deleted.  =^]
|>
|>    Ok, hands up everybody who DIDN'T immediately know that this had to be
|>a posting from a .edu site.

I used to think that SEX was something to do with byte ordering in 16- or 32-
(or more) bit values (or was it nybble ordering?)?  Does it mean something
else as well?  Have I been spending too much time in front of my computer :-)
Incidentally - has the term 'nybble' ever _really_ entered common usage or
is it just a figment of my imagination?

Lezz "No SEX please I'm a software engineer" Giles
From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe)
Newsgroups: comp.lang.c
Subject: Re: EASY C
Date: 11 Sep 92 08:32:00 GMT
Organization: Comp Sci, RMIT, Melbourne, Australia

In article <faivre.716143938@cst02>, faivre@cst02.segin.com (Denis Faivre) writes:
> This is definitely no joke. I know someone seriously considering to "adapt" C
> (for COBOL programmers, as you guessed it in your second message) by such a
> technique as EASY C.

I've had to deal with code which used
	#define or else if
I am not kidding about that, and I was not at all pleased about it either.
One of my reactions was "why aren't these cowboys willing to write in C?"

The effect of using an idiosyncratic language loosely based on C (which is
what a set of macros like EASY C is) is to
    - make sure that people who learn this language will have a hard time
      with C
    - make sure that people who know C will have a hard time with this
      language
    - confuse the heck out of support tools like `indent', `ctags',
      `cflow', `calls', `cxref', ...
    - seriously perturb the electric-C-modes provided by several editors 
    - lose you a lot of friends (especially people who have to maintain
      the code afterward).

Let's face it, the syntax is the EASIEST part of C to master.
I just spent 3 hours yesterday and another 3 hours today helping a student
with a C program.  Her mastery of the _syntax_ was complete, but she didn't
understand things like
    - how to read words from a file?
	while (fscanf(infile, "%80s", word) == 1) { process(word); }
    - how to build a linked list by inserting things at the end?
      typedef struct ListNode *ListPtr;
      struct ListNode { ListPtr next; SomeType item; };
      ListPtr result, *tail = &result, new;
      ...
	new = (ListPtr)emalloc(sizeof *new);
	new->item = something;
	*tail = new;
	tail = &(new->next);
      ...
      *tail = NULL;
    - what can cause a segmentation fault?
      in this case, using fopen() and not checking the result.
    - what is the difference between strcpy() and strncpy()?
    - how can I maintain a key->value mapping on disc?
       use ndbm(3) or sdbm(3L)
    - how do I debug a C program?
       [actually, she knew a pretty good method:  ask a lecturer...
        We did try dbx, but it crashed...]
and a whole bunch of stuff at that level.


-- 
You can lie with statistics ... but not to a statistician.
Newsgroups: comp.lang.c
From: ccewch@nuscc.nus.sg (Wong Chee Heng)
Subject: Re: General data structure and algorithm C source
Organization: National University of Singapore
Date: Thu, 10 Sep 1992 07:10:18 GMT

Where can I get a soft copy of these source codes?

--
Wong Chee Heng
Systems Programmer
From: GUEST033@COMPUBBS.ORG
Newsgroups: comp.lang.c
Subject: Personal to Nancy C. (nobody else please read)
Date: 10 Sep 92 16:41:40 GMT
Followup-To: junk
Organization: COMP-U-TEK PUBLIC BBS (412)722-9110 [2400 8N1]

Hi.  I am new to these country.  My freinds tell me I can post to 
these bulletin boards and they will helps me find my old freinds. 
I only know here first name & last initial but maybe you can help 
me find Nancy C. She is very nice to looking.  Thank you all very 
much for your helps if any.
Newsgroups: comp.lang.c,comp.lang.c++
From: mcook@melkur.dev.cdx.mot.com (Michael Cook)
Subject: Re: Help!!! Please Read this message!?!?!?!?!...
Organization: Motorola Codex, Canton, Massachusetts
Date: Wed, 9 Sep 1992 13:12:46 GMT

eletanjm@nuscc.nus.sg (TAN JIN MENG) writes:

>If the printf doesn't understand %f, it will print "%f" verbatim and not
>even attempt to interpret it.

When I said "doesn't understand", I meant "doesn't handle properly".

Michael.
From: nadeau@JSP.UMontreal.CA (Nadeau Jean-Claude)
Newsgroups: comp.lang.c
Subject: Re: extern struct
Date: 15 Sep 92 15:25:57 GMT
Organization: Universite de Montreal

In article <1428@yetti.UUCP> g-yao@cs.yorku.ca (Ling Yao) writes:
>Hi, dear friends:
>
>	As a ``C'' novice, I would  like to ask some advice about how to 
>	use extern struct.
>
>
>what I did:
>
>----------------file 1------------------------------
>struct point{
>	float x;
>	float y;
>	float z;
>	};
>
>	static struct point p[100][100];
        ^^^^^^

	That's the problem.  The variable "point" is local to file 1.
	Just remove the static qualifier, making the variable global
	and it'll work.
-- 
Jean-Claude Nadeau, ing.	<nadeau@JSP.UMontreal.CA>
Services informatiques		<nadeau@ERE.UMontreal.CA>
Universite de Montreal		<nadeau@UMTLVR.BITNET>
Tel. (514) 343-6111,ext 5234	Fax  (514) 343-2155
Newsgroups: comp.lang.c
From: cheselka@cactus.org (Michael R. M. Cheselka)
Subject: printf and scanf of long doubles
Summary: scanf(" Enter a long double: %Lg", &long_double) madness
Organization: Capital Area Central Texas UNIX Society, Austin, Tx
Date: Mon, 7 Sep 1992 03:01:18 GMT

This works, but not if I use %Lg or %Lf.  Why?  Is %lf only available?

#include <math.h>

long double long_double;
unsigned char error_code;

main()
{
printf("Enter a long double: ");
if ( (error_code=scanf("%lf", &long_double)) == 1 )
printf("You entered %lg\n", long_double);
else
printf("long double scanf failed\n");
exit(error_code);
}
-- 
cheselka@cactus.org               N5UVV              Michael R. M. Cheselka
os9@gnu.ai.mit.edu        Hangs out on 145.21mhz       400 W. 34th st. #103
membership@cactus.org                                 Austin, TX 78705-1331
{...}!cs.utexas!cactus.org!cheselka (512)452-9412v ( 24hours answer. mach.)
Newsgroups: comp.lang.c