HDTenEightyP/NetNews huggingface dataset:
From: cterzian@cals.logiconultra.com (Christina Terzian)
Subject: C Courses
Organization: Logicon_Ultrasystems
Date: Wed, 27 Jan 1993 18:37:56 GMT

I am trying to locate a fast-paced 4- or 5-day (all day) C course held in  
the Los Angeles or Orange County area in February; a course that will  
teach the basics of programming in C.  Any one know of any?

Thanks!
From: jos@and.nl (Jos Horsmeier)
Newsgroups: comp.lang.c
Subject: Re: HALLOC and HUGE ptrs in Microsoft C
Date: 23 Jan 93 13:19:30 GMT
Distribution: world,local
Organization: AND Software BV Rotterdam

In article <1993Jan22.144653.24939@klaava.Helsinki.FI> wirzeniu@klaava.Helsinki.FI (Lars Wirzenius) writes:
|jjr@ace.ece.arizona.edu (Jeffrey J. Rodriguez) writes, about using
|arrays larger than 64 kB under MS-DOS (notoriously an awkward
|problem):
|
|>This sure seems cumbersome.  It also seems that a program written for
|>PC-DOS using halloc and huge ptrs would not run on a Sun running
|>UNIX.  So much for portable C.

|Quite.  The approaches I have followed are (more or less in the order
|of preference):
|
|a) forget about DOS machines and write the code under Unix
|b) use a compiler under DOS that doesn't require halloc or other
|   monstrosities for >64 kB arrays (djgpp is my choice)
|c) don't use >64 kB arrays
|
|I avoid halloc and huge pointers and other compiler-specific methods
|like the plague they are.  Not only are they non-portable, they would
|require me to learn and understand them first (lazy, ain't I?), and to
|have to rely on the compiler to get things right while I'm not very
|certain that I have understood things correctly.

I agree with you wholeheartedly, of course, but don't forget that a PC
is a very small machine, compared to others. Its processor (Intel 80x86)
is a very, very funny hodge podge of micro cooking utensils. If a full
blown pointer is used (say: p), a simple operation like: `p++' causes
a lot more machine instructions when defined as a `huge' pointer than
if it were defined as it should have been defined: no `huge' or `far'
or `humongous' prefixes whatsoever. IMHO, at Intel they don't know
how to build nice processors, they _do_ know how to squeeze millions
and millions of gates on a square inch of silicon and they're even 
proud of it. To paraphrase John Cleese: `It's a waste of space.'

I've seen the following lines once in a signature file, and I think
I like them a lot:

Our sun is not the only star in the universe.
Our planet is not the only planet rotating around a star, in the universe.
Our planet is not the only planet with an `intelligent' life form on it.
Our planet _is_ the only planet in the universe, where they use MSDOS.

kind regards,

Jos aka jos@and.nl

ps. ;-)
Xref: sparky comp.lang.c:20355 comp.std.c:3445
From: dgm@corvus (David Matusow)
Newsgroups: comp.lang.c,comp.std.c
Subject: mktime
Keywords: mktime time daylight savings
Date: 28 Jan 93 15:08:41 GMT
Followup-To: dgm@adonis.az05.bull.com
Organization: Online Communication Consultants

I am having some difficulty with the mktime function.  As you cand
see from the following debug session, mktime is changing the hour
of the tm structure.  It is my understanding that mktime() should 
only modify the tm_yday and tm_wday components.  What is causing mktime()
to perform this "majic" and what can I do to stop it?

My first thought is that this is caused by a daylight savings time
problem.  Of course, dst is NOT in effect in December and is not
in effect AT ALL here in Arizona.

Please forward my directly to me, as I seldom read this news group.

Thanks for the help,
-- 
David Matusow                                    Online Communication Consultants      
dgm@adonis.az05.bull.com (on contract to Bull)   2015 N. Dobson Rd. Ste. 4-B10
CS - 70243.2410@CompuServe.COM                   Chandler, AZ. 85224 
(602) 862-5223 (at Bull)                         (602) 786-3533
Newsgroups: comp.lang.c,comp.lang.c++
From: steve@taumet.com (Steve Clamage)
Subject: Re: C/C++ Correctness (was: Re: C/C++ Speed)
Organization: TauMetric Corporation
Date: Thu, 28 Jan 1993 16:56:59 GMT

pete@borland.com (Pete Becker) writes:

>In article <1k6m67INNgqv@emx.cc.utexas.edu> jamshid@emx.cc.utexas.edu (Jamshid Afshar) writes:
>>
>>	int i;
>>	int** p = &i;
>>
>>But isn't the above code legal C?  ...

>	Yes, it is legal C...

No, it is NOT legal C.  The type of p is int**, and the type of &i
is int*.  This violates a constraint in ANSI section 3.3.16.1 (Simple
Assignment), and must be diagnosed as an error.  Although this is
technically an initialization, section 3.5.7 (Initialization) says that
the rules for assignment apply.
-- 

Steve Clamage, TauMetric Corp, steve@taumet.com
Newsgroups: comp.lang.c
Subject: Microsoft library access from Turbo C?
From: sullivan@kenyon.edu
Date: 21 Jan 93 17:14:55 -0500
Organization: Kenyon College

I have some DOS hardware with a software library to use it written for
Microsoft C (ver 4.00). Is there a way to link code I write in Turbo C++ (ver
2.00, I think) to this library?

Thanks for any help,

Tim Sullivan   (sullivan@kenyon.edu)

Xref: sparky comp.lang.c:20227 comp.lang.fortran:5191
From: ajayshah@almaak.usc.edu (Ajay Shah)
Newsgroups: comp.lang.c,comp.lang.fortran
Subject: Re: calling a Fortran subroutine from a C program
Date: 26 Jan 1993 08:02:27 -0800
Organization: University of Southern California, Los Angeles, CA
Distribution: na
NNTP-Posting-Host: almaak.usc.edu

This may help:

An extract from my Index to free C for numerical computation

Name: Cfortran
Where: zebra.desy.de [131.169.2.244]
Systems: VAX VMS or Ultrix, DECstation, Silicon Graphics, IBM RS/6000, Sun, CRAY, Apollo and HP9000.
Language: C, FORTRAN 
Author: Burkhard Burow, burow@vxdesy.cern.ch, University of Toronto
Version: 2.5
Description: A set of macros (cfortran.h = 1000 lines) allowing function calls to be made from C to FORTRAN and vice-versa.
Comments: Good compact way of calling functions without translating. Easy to use.

-- 
Ajay Shah, (213)749-8133, ajayshah@rcf.usc.edu
Newsgroups: comp.lang.c
From: gjb7307@Msu.oscs.montana.edu
Subject: Unix getch()-like routines
Reply-To: gjb7307@Msu.oscs.montana.edu
Organization: Montana State University
Date: Tue, 26 Jan 1993 01:28:59 GMT


Hello netters,

I am looking for some C or C++ routines to do single-character input on an
Ultrix system.  Does anyone have any that they'd let me see?  I think this
has been posted before but our newsreader doesn't have it anymore.  The
message line hints at it is why I'm assuming that.  But, if anyone has 
the routines or knows where I can anon ftp them, I would really appreciate
it if you would email me.  Or post, I read this newsgroup quite a bit.
Thank you very much!  

Jeff

Xref: sparky comp.lang.c:20044 comp.lang.c++:19722 sci.math.num-analysis:3924
From: ss107@cunixb.cc.columbia.edu (Sergey  Shamis)
Subject: Re: Could someone answer my question....thanks
Reply-To: ss107@cunixb.cc.columbia.edu (Sergey  Shamis)
Organization: Columbia University
Date: Tue, 26 Jan 1993 02:32:36 GMT

In article <1993Jan26.000105.10930@njitgw.njit.edu> csc5840@hertz.njit.edu (Sekhar Chitti) writes:
>Hi Netters,
>
>
>Following is a C program in which I tried to simulate command
>line arguments (argc, argv). I am not getting the expected
>output which should be the same as when argc, argv are used.
>
>
>
>#include <stdio.h>
>
>main(arg1,arg2)
>int arg1;
>char *arg2[];
>{
>	int i;
>	for(i=0;i<arg1;i++)
>		puts("%d - %s",i,arg2[i]);
>}
>
>
>The following is the output when I tested the program for diff no.
>of arguments. The 'for' loop iterates exactly the number of arguments,
>but when I tried to print the number of args, as u can see from the
>output, I am getting it wrong...
>
>6:45pm C-> a.out arg2
>%d - %s
>%d - %s
>6:45pm C-> a.out arg2 arg3
>%d - %s
>%d - %s
>%d - %s
>6:46pm C-> a.out arg2 arg3 arg4
>%d - %s
>%d - %s
>%d - %s
>%d - %s
>6:46pm C-> a.out 
>%d - %s
>
>
>Could somebody suggest me in this regard ? Thanks in advance.
>
>Sekhar Chitti


Well, as far as I know, puts() does not recognize any format
specifiers (like %d, %s, etc).  It just takes a string as an argument
and prints it out on the sdout.  That's why you get these results (it
prints just the string, i.e. whatever is inside the quotation marks).


Xref: sparky comp.lang.c:20336 comp.os.msdos.programmer:12535
From: nathans@pacifier.rain.com (Nathan Silva)
Newsgroups: comp.lang.c,comp.os.msdos.programmer
Subject: Re: DOS File Locking
Summary: Summary of replies
Date: 27 Jan 93 22:28:52 GMT
Followup-To: comp.os.msdos.programmer
Organization: Pacifier BBS


>
>I am writing a small Windows application in Turbo C++.  I'd like
>to lock a region of a file so that other processes can still read
>it, but cannot write to it.  However, when I use the standard
>lock/unlock functions, other processes cannot read the locked region.
>

As some of you pointed out, comp.lang.c is not the best newsgroup for
this.  However, since some people asked for a summary, here it is
(followups to comp.os.msdos.programmer).

One person suggested adding a one-byte "flag" to the structure that I
am using.  The flag would be used to control access to that particular
record.  This is a good choice if portability is a concern.

Another reply described an interesting technique - lock a nonexistent
portion of the file.  For example, to "lock" bytes 250-350, you would
lock (logical) bytes 1,000,000,250 - 1,000,000,350.  This works under
DOS/Windows... I don't know if it's portable.  This is the method I'm
using.

There were other replies; thanks to all who replied.

Nathan
-- 
 -------------------------------------------------------
| Nathan Silva               |                          |
| nathans@pacifier.rain.com  | Do the World News Polka! |
 -------------------------------------------------------
From: jos@and.nl (Jos Horsmeier)
Newsgroups: comp.lang.c
Subject: Re: Three dimensional array.
Date: 24 Jan 93 13:39:26 GMT
Organization: AND Software BV Rotterdam

In article <1993Jan23.173200.24497@news.uiowa.edu> hari@blackmail.eng.uiowa.edu (Hari Vattikota) writes:
|I have an 3 dimensional array(big one)[64000][180][2]. each element
|of this array is 1 bit.
|
|How do I declare and store this array so that the memory usage is
|minimum ? Also I should be able to read and write any of the 
|element with minimum of masking or any other bit operations.

Since most hardware doesn't support an address resolution of one single
bit, bit masking is inevitable. The following solution comes to mind:

#define BPB 8			/* Number of Bits Per Byte (assume 8) */

char arrayb[64000/BPB][180][2];

#define array_get(i, j, k)	(arrayb[i/BPB][j][k]&(1<<(i%BPB))?1:0)
#define array_set(i, j, k) 	(arrayb[i/BPB][j][k]|= (1<<(i%BPB)))
#define array_rst(i, j, k)	(arrayb[i/BPB][j][k]&= ~(1<<(i%BPB)))

Here the storage requirements are minimal, but unfortunately, there _is_
some bit fiddling necesary ... On the other hand, using bit fields
(which cannot be indexed) will be a mess. It'll look something like this:

#define BPW 16			/* Number of Bits Per Word (assume 16) */

typedef struct {
	unsigned int b00:1;
	unsigned int b01:1;
	unsigned int b02:1;
	unsigned int b03:1;
	unsigned int b04:1;
	unsigned int b05:1;
	unsigned int b06:1;
	unsigned int b07:1;
	unsigned int b08:1;
	unsigned int b09:1;
	unsigned int b10:1;
	unsigned int b11:1;
	unsigned int b12:1;
	unsigned int b13:1;
	unsigned int b14:1;
	unsigned int b15:1;
} WORD;

WORD barray[64000/BPW][180][2];

unsigned int array_get(int, i, int, j, int, k) {

	WORD w = barray[i/BPW][j][k];

	switch (i%BPW) {
		case 0: return w.b00;
		case 1: return w.b01;

		/* etc. etc. */

		case 15: return w.b15;
	}
}

Well, you get the picture ... I prefer the bit masking method myself.

kind regards,

Jos aka jos@and.nl
Newsgroups: comp.lang.c,comp.lang.fortran
From: michael@chpc.utexas.edu (Michael Lemke)
Subject: Re: calling a Fortran subroutine from a C program
Organization: The University of Texas System - CHPC
Date: Fri, 22 Jan 93 19:06:24 GMT

In article <1993Jan22.130743.27130@sol.ctr.columbia.edu> bobp@msi.com (Bob Pitha) writes:
>Scott White (swhite@mathcs.emory.edu) wrote:
>: Can someone please tell me how to call a Fortran subroutine from a C program?
>: The environment is sun4, OS 4.1.2.
>
>Sure, this isn't really that hard as long as you keep a few basic issues in
>mind:
>
[...]
>
>4) Character arrays: For each character array in the argument list, there
              ^^^^^^
> should be a long int at the end of the argument list specifying the
> *declared* length of the array - that is, how much space is allocated
> for it.  Since Fortran blank-fills character arrays, this number will
> specify how many places to fill.  If you have more than one character
> array in the argument list, the length arguments should be in the same
> order as the character arguments.
>
[...]
> (and now the Fortran part)
>
>      subroutine MyFortranSub (int_arg, float_arg, int_array,
>     +                         int_matrix, string)
>      integer       int_arg
>      real          float_arg
>      integer       int_array (3)
>      integer       int_matrix (3, 4)
>      character*(*) string
                     ^^^^^^

You are not talking about character arrays at all in your post.  A 
character array is something you declare as

	character*(*) string(10)

which is an array of strings.  You talked just about plain character
strings.  Keep the terms clear.  Passing of character arrays is a bit
harder than what you described I believe (I might be wrong) but I don't
have my Sun manual handy to point out the differences.  Someone else
might.  But as you have suggested (which I deleted for brevity) reading
the Sun Fortran manual is worth doing.  It deals with all these issues.

Michael
-- 
Michael Lemke
Astronomy, UT Austin, Texas
(michael@io.as.utexas.edu or UTSPAN::UTADNX::IO::MICHAEL [SPAN])
From: scjones@thor.sdrc.com (Larry Jones)
Newsgroups: comp.lang.c
Subject: Re: Preprocessor question
Keywords: Preprocessor, string
Date: 26 Jan 93 16:02:28 GMT

In article <1993Jan25.161425.27962@bnrmtl.bnr.ca>, karim@bnrmtl.bnr.ca (Karim Younes) writes:
> I am trying to have a #defined variable recognized by the
> preprocessor inside a string. In other words, I want to
> do something like this:
> 
> #define JUNK 50
> static char *junk = "JUNK ways to leave your lover."

If you have an ANSI/ISO Standard C compiler, you can use the new
stringizing operator and string concatenation to get what you want:

#define stringsub(x)	string(x)
#define string(x)	#x

#define JUNK 50
static char *junk = stringsub(JUNK) " ways to leave your lover.";

If you have an older compiler that doesn't support stringizing or
concatenation, you might be able to get away with something like:

#define stringsub(x)	"x"

#define JUNK 50
static char *junk = stringsub(JUNK ways to leave your lover.);

but I wouldn't count on it.
----
Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH  45150-2789  513-576-2070
larry.jones@sdrc.com
Sheesh.  Who can fathom the feminine mind? -- Calvin
From: senerat@g2syd.genasys.com.au (Senerat Rajakaruna)
Newsgroups: comp.lang.c
Subject: Re: Btree, or Linked List Questions
Date: 21 Jan 93 01:53:58 GMT
Organization: Genasys II, Sydney, Australia

In article <C13soz.73L@murphy.com> gregb@murphy.com (Greg Banschbach (Unigroup of New York)) writes:
>
>
>	Dear fellow C programmers,
>
>		I have 2 questions regarding code I have seen:
>
>	1.    When you create a Btree, most books detail how to 
>	      do deletions and insertions to add to the tree, and 
>	      it usually involves using "malloc" to create a node,
>	      and "free" to delete it.     I saw some code once 
>	      where, when they were finished with the tree, they 
>	      just said  free(tree).     I thought you had to free
>	      each individual node throughout the tree before you 
>	      could free the root node.     What gives ?    
>
>	2. 	What happens with linked lists ?   Do you simply 
>		" free " the head - and the rest of the chain is
>		de-allocated ?
>
>	Please try to support your answers with either quotes from 
>	a known source OR something equally as secure ( proven ). 
>
>	Please e-mail me at:     uunet!murphy!galunix!greg  OR
>				 gregb@murphy.com
>
>	Thanks for the input guys 
>	Greg Banschbach
>	( Not an employee at murphy ).

Blocks of memory obtained dynamically via calls to malloc or calloc should
be freed by calling free() if dynamic memory is to be maintained for wider use.
Each such allocation will cause the processes pre-allocated dynamic memory
space to be reduced and it will subsequently run out if not freed. Once freed
memory space can be regained via calls to malloc or calloc.

	'There are no restrictions on the order in which space is freed,
	 but it is a ghastly error to free something not obtained by calling
	 calloc or malloc'

		- The C Programming Language by K & R (ANSI C) - p167

Freeing the head of a linked list or a Btree only frees the space reserved
in storing the address of the structure as defined for the head. Individual
space gained via calls to malloc or calloc must be freed together with their
head to save the precious dynamic memory.

The right way to free a linked list is to save the next pointer of head 
before freeing:
	
	LIST *p, *q;

	for (p = head; p != NULL; p = q)
	{
		q = p -> next;

		/* free any sub-elements of current head */
		FreeData(p);
		(void) free((void*) p);
	}

	/* reset head */
	head = (LIST *) NULL;

See K & R pages 185 - 189 for a detailed description of how memory lists are
handled by the operating system. 


Senerat Rajakaruna  |  Genasys II Pty Ltd
                    |  13th Level, 33 Berry St, North Sydney, NSW, Australia
                    |  Phone:    +61-2-954-0022 (-9930 FAX)
                    |  Internet: senerat@g2syd.genasys.com.au
From: pmuench!pmuench (Paul Muench)
Newsgroups: comp.lang.c
Subject: Re: Prodigy_CompuServe_AmericaOnline
Keywords: AmericaOnline
Date: Wed, 20 Jan 93 19:56:17 PST
Distribution: ?
Organization: IEEE

I know that America ONline is aol.com.  I'm not sure that this is the
information your are seeking.
Newsgroups: comp.lang.c
From: ertle@kira.uvm.edu The Sneaky Devil
Subject: Re: Btree, or Linked List Questions
Organization: University of Vermont -- Division of EMBA Computer Facility
Distribution: default
Date: Sat, 23 Jan 1993 22:14:17 GMT

In <1993Jan23.182957.25180@scorch.apana.org.au> harris@scorch.apana.org.au (Michael Brown) writes:


>    for(;(temp_ptr=head_ptr)!=NULL;free(temp_ptr)) head_ptr=head_ptr->next;
>    

This looks bogus to me.  temp_ptr points to what head_ptr points to.
Then you free what temp_ptr points to, leaving it and head_ptr
pointing at nothing.  Then you try to access what head_ptr points at.

   Your "C" package/operating system might not use the freed memory
immediately, so this might work, but I don't think that you can count
on it being portable.



--
James A. Ertle                       |Don't be such a guppy!!
ertle@{hal|sal|kira|griffin}.uvm.edu |
UVM's EMBA Computer Facility         |	 	-Ariel
Burlington, Vt. USA                  |
Newsgroups: comp.lang.c
From: nathans@pacifier.rain.com (Nathan Silva)
Subject: DOS file locking
Organization: Pacifier BBS
Date: Sat, 23 Jan 1993 01:49:32 GMT



I am writing a small Windows application in Turbo C++.  I'd like
to lock a region of a file so that other processes can still read
it, but cannot write to it.  However, when I use the standard
lock/unlock functions, other processes cannot read the locked region.

How can I do "read-only" locking?

ObSetupInfo: Yes, SHARE is loaded.  I'm using DOS 5.0, Windows 3.1,
             Turbo C++ for Windows 3.0.

Please reply by e-mail to nathans@pacifier.rain.com.

Nathan

-- 
 -------------------------------------------------------
| Nathan Silva               |                          |
| nathans@pacifier.rain.com  | Do the World News Polka! |
 -------------------------------------------------------
Newsgroups: comp.lang.c
From: harald@marilyn.bion.kth.se (Harald Winroth)
Subject: Re: Preprocessor question
Organization: Royal Institute of Technology, Stockholm, Sweden
Date: Wed, 27 Jan 1993 15:15:51 GMT

In article <1099@quirm.terminus.ericsson.se> srl@terminus.ericsson.se (Steve Langstaff) writes:

>   In article 1k44lqINNjr3@rs2.hrz.th-darmstadt.de, misar@rbg.informatik.th-darmstadt.de (Walter Misar) writes:
>   : In article <mick.728072797@picus>, mick@dcs.bbk.ac.uk (Mick Farmer) writes:
>   : > Hi,
>   : > 
>   : > Karim asks how to get a preprocessor macro recognised inside
>   : > a string.  The answer, at least in ANSI C, is to use the
>   : > stringising operator and string concatenation:
>   : > 
>   : > #define JUNK 50
>   : > static char *junk = #JUNK " ways to leave your lover"
>   :                       ^^^^^
>   : Nope, #token works only with #defines like in:
>   : #define stringify(x) #x
>   : #define str_exp(x) stringify(x)		/* this extra level IS necessary */
>   : static char *junk = str_exp(JUNK) "ways ....";
>   : 
>   [snip]
>
>   Why is the extra level necessary?

Because further macro replacements will not be done for arguments which
correspond to formal macro parameters adjacent to # or ## in the body. 
stringify(JUNK) will therefore expand to "JUNK", not to "50".
-----------------------------------------------------------------------------
Harald Winroth      |  Computational Vision and Active Perception Laboratory,
harald@bion.kth.se  |  Royal Institute of Technology, Stockholm, Sweden.
-----------------------------------------------------------------------------
From: woodard@figment.tmc.edu (Chris Woodard)
Newsgroups: comp.lang.c
Subject: Re: Questions on PRINTERS, PRINTING
Date: 23 Jan 93 18:33:12 GMT
Organization: University of South Florida, Department of Computer Science and Engineering



To print from within a Borland C program, the following code will work

    fprintf( stdprn, "\f" );    /* send a form feed */
    fprintf( stdprn, "Feed me!\n" );  /* send an amusing message */

stdprn is a predefined stream pointer in the Borland package just like
stdout, stdin, or stderr; it gets initialized and pointed to LPT1 when
the program starts up (and the first fprintf call is made).

Chris Woodard
Newsgroups: comp.lang.c
From: macg9505@uxa.cso.uiuc.edu (Michael Alan Corn)
Subject: fast math libraries
Organization: University of Illinois at Urbana
Date: Thu, 21 Jan 1993 03:11:40 GMT

Hello,
	Could someone suggest a PD/Shareware (or atleast inexpensive)
	fast math package?  Ideally I'd like a linkable replacement for
	the emulation package that comes with BC3.1++.  I'm especially
	interested in trig functions; code, libraries, classes, or even
	some good algorithms would be greatly appreciated.  I've tried 
	using the math routines in Mark Peterson's Fractint package, but
	(no doubt due to user error) I haven't been able to get them to
	link properly (are you out there Mark???), Thanks in advance.
	Mike
	macg9505@uxa.cso.uiuc.edu