HDTenEightyP/NetNews huggingface dataset:
From: md@sco.COM (Michael Davidson)
Subject: Re: strtol() return values
Organization: The Santa Cruz Operation, Inc.
Date: Tue, 26 Jan 1993 12:36:14 GMT


ric@updike..sri.com (Richard Steinberger) writes:

>	strtol() returns a long int when successful.  If a non-numeric
>string is encountered, 0 is returned.  Unfortunately, errno doesn't seem
>to be set.  Here's the question:  If a string like, "0" or "000"
>is encountered, I also get a 0 returned from strtol(). Is there an easy,
>elegant way to check for this without examing each char?  

Yes - try something like this:

	char	**p;

	if ((value = strtol(str, p, 0)) == 0 && *p == str)
	    printf("strtol() failed!!\n");

Newsgroups: comp.lang.c
From: gmr6139@ultb.isc.rit.edu (G.M. Richard)
Subject: Help!!!  Turbo C++ freezes up my computer!!
Organization: Rochester Institute of Technology
Date: Sun, 24 Jan 1993 19:32:27 GMT

I am using Turbo c++ 2.0 on my Tandy 1000, with 640k of memory.  When
I try to compile programs, my computer completely locks up, and I need
to reset it.  It doesen't happen all the time, but (seemingly) ramdomly
and it is quite frustrating.  I'm writing standard ANSI C code, no 
special compiler or assembler instructions, and nothing really weird (or
so I think).  If anyone else has had this problem, or thinks they can
help me, please send me e-mail!!

Any help at all would be greatly appreciated!

-- 
  _  _                __                         gmr6139@ultb.isc.rit.edu
 /| /|  __  _/__/_   /__) ' __  /_  __ ,_  __/  gmr6139@george.cs.rit.edu
/ |/ |_/-/__/__/____/ \__/_/___/ /_/-/_/__/_/  gmr6139@ritvax.isc.rit.edu
____________________________________________  gmr6139@ritlav.isc.rit.edu
Newsgroups: comp.lang.c
From: ljnelson@unix.amherst.edu (LAiRD j. NeLSoN)
Subject: Re: Not a FAQ, but FAQlike: Rnd Numbers?
Organization: Amherst College
X-Newsreader: TIN [version 1.1 PL7]
Date: Sat, 23 Jan 1993 04:41:01 GMT

I wrote:

> Thanks for replies; please do so via email as I do not read this group very
> often due to volume.  Speaking for all newbies, we really appreciate your
> support.

The support has been fantastic!  Thanks; I am now rich in advice, saturated
with wisdom, and I have suggested source code flowing out of every orifice
of my body.  :)  :)  In other words, many MANY thanks to all who responded,
but you can stop now.  :)

LAiRD

--
ljnelson@unix.amherst.edu           |
ljnelson@amh.amherst.edu            |          The Quintet-essential.
(413) 542-2932                      |
From: rdb@po.CWRU.Edu (Robert D. Benedict)
Newsgroups: comp.lang.c
Subject: Topspeed C ???
Date: 28 Jan 1993 22:39:24 GMT
Organization: Case Western Reserve University, Cleveland, OH (USA)
Reply-To: rdb@po.CWRU.Edu (Robert D. Benedict)
NNTP-Posting-Host: slc12.ins.cwru.edu





Anyone heard of Topspeed C? I am looking for some input
as to quality, comparisons to 'name brand' type compilers.
I have never heard of this name, but it is used for program
 development for the Psion 3 palmtop computers.

Thanks,
	Bob
-- 
Robert D. Benedict	                        Case Western Reserve University
rdb@po.cwru.edu	                                            Clarke Tower
ab555@cleveland.freenet.edu			        Cleveland, OH 44106
ad194@medina.freenet.edu		              	   (216)754-1104
From: mendez@taliesin.greco-prog.fr (Mendez Marc)
Newsgroups: comp.lang.c
Subject: Re: File manipulation from a program...PLEASE HELP!
Date: 27 Jan 93 22:32:50 GMT
Organization: LMI (LaBRI University Bordeaux France)
X-Newsreader: TIN [version 1.1 PL7]

Jason Pardee (pardee@cs.uiuc.edu) wrote:
> i want to know if there is a way to rename a file from a C program.  you know,
> the equivalent of the command 'ren ldfilename> <newfilename>'.  is there
> such a function in C?  if not,  is there a way to invoke a DOS command from
> within a program, meaning, is there a way i can execute the 'ren' command
> inside my program?
> 

Well, use the "rename" function. Here is an extract from Unix manual :

     NAME
          rename - change the name of a file

     SYNOPSIS
          int rename(from, to)
          char *from, *to;

     DESCRIPTION
          rename causes the link named from to be renamed as to.  If
          to exists, it is first removed.  Both from and to must be of
          the same type (that is, both directories or both non-
          directories) and must reside on the same file system.

          rename guarantees that an instance of to will always exist,
          even if the system should crash in the middle of the
          operation.
[...]
--

   =====================================================================
  |   MENDEZ Marc 	E-Mail 	   : mendez@taliesin.greco-prog.fr	|
  |	  			     mendez@taliesin.emi.u-bordeaux.fr  |
  |			Home Phone : (33) 56 46 14 52			|
  |	    Licence d'informatique - UFR d'informatique -		|
  |		  Universite de Bordeaux 1 - France			|
   =====================================================================
   "The trouble with computers is they do everything we tell them to do,
		 but not what we would like them to do." (unknown)
   "Un homme n'a pas lieu d'etre malheureux tant que ses regrets n'ont
		 pas remplace ses reves." (unknown)
From: alane@wozzle.linet.org (J. Alan Eldridge)
Newsgroups: comp.lang.c
Subject: Re: Help with spawnl() function
Date: 21 Jan 93 03:56:28 GMT
Organization: Disorganization

jaf@jaflrn.UUCP (Jon Freivald) writes:

> Why not use remove() or unlink()?  You can't do "system("del file")
> because del (& erase) are internal commands, although you could do
> "system("command /c del file")" [a consideration here - what about folks
> who don't use command.com?  It's no-where on my machine, and which
> command processor I'm using depends on what mood I'm in..!]

char szCmdbuf[ 130 ];
char *szComspec=getenv("COMSPEC");

if (!szComspec)
    szComspec="COMMAND.COM";
sprintf(szCmdbuf, "%s /C del file", szComspec);
system(szCmdbuf);


alane@wozzle.linet.org (J. Alan Eldridge)
Fido: The University of Walamaloo 1:272/38.473
Newsgroups: comp.lang.c
From: steve@taumet.com (Steve Clamage)
Subject: Re: Possible bug in BC 3.1: ellipsis in proto argument list
Organization: TauMetric Corporation
Date: Sun, 24 Jan 1993 16:16:12 GMT

sg0d@ns1.cc.lehigh.edu (STEPHEN R. GILBERT) writes:

>I seem to have found a bug in my Borland C++ 3.1 compiler.  I narrowed
>the problem down to the following prototype:

>void foo(...)

>If the above line is by itself in foo.h and I run:
>bcc -P -c foo.h
>It compiles without mishap.  If you're wondering: -P is to force a C++
>compile and -c is compile to .obj only.

>The problem is that if I try to compile without the -P, that is,
>compile in regular, standard BC 3.1, I get the error message:
>) expected

The compiler is correct.  This reflects a difference between C and C++.

In Standard C, a function must have at least one argument declared before
the ellipsis.  On the other hand, you may declare a function with
completely unspecified arguments by using empty parens.  In C++, the
empty parens mean the function takes no arguments.  To say a function
has completely unspecified arguments in C++, use just the ellipsis.
Examples:

	void f1(int, ...);  /* C and C++: f1 takes one int plus other
				unpsecified args */

	void f2();	/* C: no data about the arguments to f2 */
			/* C++: f2 takes no arguments */

	void f3(...);	/* C++: no data about the arguments to f3 */
			/* C: illegal */

You can't write function f3 in C++, although you can declare it.  There is
no (portable) way to retrieve arguments when only an ellipsis is declared.
You need to use the <stdarg.h> macros which require a declared argument.
If you try to use the C trick of defining the real function with its real
arguments, your program won't link, since foo(...) and foo(int), for
example, are different functions.  The ellipsis-only notation is to allow
linking to functions written in another language (not C++) where the
calling conventions just happen to work and you are willing to forgo type
checking and default promotion of actual arguments.
-- 

Steve Clamage, TauMetric Corp, steve@taumet.com
From: alien@acheron.amigans.gen.nz (Ross Smith)
Newsgroups: comp.lang.c
Subject: Re:  Pattern Matching for Spelling Correction
Date: 22 Jan 93 13:29:31 GMT+12
Distribution: world
Organization: Muppet Labs

In article <1993Jan16.021454.27242@thunder.mcrcim.mcgill.edu> mouse@thunder.mcrcim.mcgill.edu (der Mouse) writes:
>In article <alien.02g6@acheron.amigans.gen.nz>, alien@acheron.amigans.gen.nz (Ross Smith) writes:
>> In article <726524557snz@panache.demon.co.uk> raph@panache.demon.co.uk (Raphael mankin) writes:
>>> In article <1993Jan7.054651.25174@spartan.ac.BrockU.CA> tmc@spartan.ac.BrockU.CA writes:
>>>> [...something...]
>>> Sorry to be so short tempered, but does no-one ever read the
>>> journals?
>
>>> CommACM Oct 1992 Vol 35 No 10. pp74-91
>>> and a whole host of others.  Try your university library.
>
>> Sorry to be so short tempered, but try to remember that not everyone
>> is at a university or has access to journals.  Some of us
>> occasionally work in the real world.
>
>Perhaps you've forgotten, being out in the real world and out of touch
>with where knowledge is actually being advanced[%], but most university
>libraries will let people not directly part of the university community
>look at their collection.  Municipal libraries almost invariably will.

(1) What about those of us who live 100 km from the nearest university?

(2) Municipal libraries "almost invariably" don't carry specialised technical
journals. You won't find anything deeper than "Byte" in a public library,
except maybe in a handful of very large cities in the US and Europe.

--
...... Ross Smith (Wanganui, NZ) ...... alien@acheron.amigans.gen.nz ......
"I blame you for the moonlit sky and the dream that died with the Eagle's flight
I blame you for the moonlit nights when I wonder why are the seas still dry
Don't blame me, sleeping satellite"                              (Tasmin Archer)
--
From: dbbergac@sanluis (Dave Bergacker)
Newsgroups: comp.lang.c
Subject: Re: Turbo C FOPEN error
Date: 27 Jan 1993 15:37:47 GMT
Organization: University of Colorado at Colorado Springs
NNTP-Posting-Host: sanluis.uccs.edu
X-Newsreader: TIN [version 1.1 PL6]

Jeffrey R. Gilmour (gilmour@binah.cc.brandeis.edu) wrote:
: I can't figure out what's wrong.  This program works fine as long as there's
: less than 16 files (it doesn't actually matter what drive).  I haven't come
: across anything explaining it in the manual.  The error happens at runtime 
: during the 'stream = fopen(name...' line.  Anybody?
: 
: /*
: **      FOPENERR.C
: */
:  
: #include "stdio.h"
: #include "io.h"
: #include "dos.h"
:  
: void main(void)
: {
:         int done;
:         char name[15];
:         struct find_t test;
:         struct ftime ft;
:         FILE *stream;
:  
:         done = _dos_findfirst("a:*.*", _A_NORMAL, &test);
:         while (!done) {
:                 strcpy(name, "a:");
:                 strcat(name, test.name);
:                 if ((stream = fopen(name, "r")) == NULL) {
:                         printf("Error in opening filename.\n");
:                         exit (1);
:                 }
:  
:                 getftime(fileno(stream), &ft);
:                 printf("%-16s%7lu\t%2u/%02u/%u\n", name,
:                         test.size, ft.ft_month,
:                         ft.ft_day, ft.ft_year+1980);
:                 done = _dos_findnext(&test);
:         }
:         fclose(stream);
: }
: 
On a quick initial scan of the above, it would seem that you are exceeding
the limit on the number of open files per executable.  If you put the
fclose of the stream in the loop, perhaps you wouldn't have this problem.
I am assuming that you just are interested in the open file for 1
iteration of the loop since you re-use the FILE pointer stream.

--
___________________________________________________________________________
| Dave Bergacker			|				  |
| dbbergac@culebra.uccs.edu		| "I am NOT a merry man!"         |
| Any opinions expressed are almost	| Lt. Worf, Enterprise Security   |
| certainly not those of UCCS.		| "Have gahk, will travel"	  |
---------------------------------------------------------------------------
Newsgroups: comp.lang.c,comp.lang.c++
From: bandy@netnews.jhuapl.edu (Mike Bandy)
Subject: Re: Basic 3D equations
Organization: JHU/Applied Physics Laboratory
Date: Tue, 26 Jan 1993 16:35:06 GMT

twallace@gmuvax2.gmu.edu (Todd Wallace) writes:

>I am looking for code or pseudocode that will allow me to
>calculate the screen coordinates of a point in 3-space, given
>the coordinates of the viewer in 3-space.  These equations are
>the basis of programming 3D graphics, but I have not been able
>to find them.

David Rogers' texts "Mathematical Elements of Computer Graphics" and
"Procedural Elements of Computer Graphics" discuss the algorithms for 
transformation and perspective in a way that's fairly easy to implement.
I don't have them here at work; if you need the publisher, etc, E-mail me.

-- 

	Mike Bandy
	bandy@aplcomm.jhuapl.edu
	Johns Hopkins University / Applied Physics Lab
Newsgroups: comp.lang.c,comp.lang.fortran,sci.engr.mech
From: gay@selkirk.sfu.ca (Ian D. Gay)
Subject: Re: SI Units Quiz
Organization: Simon Fraser University, Burnaby, B.C., Canada
Date: Thu, 21 Jan 1993 19:26:24 GMT

Never thought I'd be on the side of the network police, but WHY is 
this stuff being posted in comp.lang.c ?????
Newsgroups: comp.lang.c
From: pmueller@ux4.cso.uiuc.edu (The Highlander)
Subject: 3D graphics libraries.
Organization: University of Illinois at Urbana
Date: Tue, 26 Jan 1993 19:57:18 GMT
Keywords: 3D graphics

Hello netters.

Does anyone know of a good public domain 3D graphics library for DOS?
I would really like original source, but .LIBs are fine too.  Also, I
would like the package to do 3D landscapes (terrian views).  Basically
something approaching VR. (A VR library would be great!)

thanks for your help!
-pete
-- 
Peter Mueller                                | You MUST pay for your sin!!!
pmueller@ux4.cso.uiuc.edu                    | 
pmueller@sumter.cso.uiuc.edu <--- NeXT Mail  | If you have already paid, 
DISCLAIMER: Help! Help! I'm being Oppressed! | please disregard this notice...
Xref: sparky comp.lang.c:20306 comp.lang.c++:20028
From: jamshid@emx.cc.utexas.edu (Jamshid Afshar)
Newsgroups: comp.lang.c,comp.lang.c++
Subject: Re: C/C++ Correctness (was: Re: C/C++ Speed)
Date: 27 Jan 1993 13:01:27 -0600
Organization: The University of Texas at Austin, Austin, Texas
NNTP-Posting-Host: emx.cc.utexas.edu

In article <1993Jan20.185607.2938@borland.com> pete@borland.com (Pete Becker) writes:
>In article <1jic36INNhn5@emx.cc.utexas.edu> jamshid@emx.cc.utexas.edu (Jamshid Afshar) writes:

	int i;
	int** p = &i;

>>Matthias writes:
>>>No, this is definitely a serious type error in ANSI C and *must* be
>>>rejected by the compiler!

>>No, it is just a warning in ANSI C.  If you're testing this with BC++
>>3.1, apparently even C compilers have bugs.

The reason I wrote this is that I compiled the code in what I thought
was BC++'s strict ANSI C mode.  BC++ gave an error and refused to
compile the code.  I thought Matthias believed type errors like this
are illegal in ANSI C because he was testing with BC++.  As it turns
out, BC++ could not have been the source of his confusion.  I made the
mistake of compiling in C++ mode instead of ANSI C mode.  To sum up,
BC++ does not have any bug in this area.  I don't know where Matthias
got the idea that the above code is not legal ANSI C.

>	ANSI C requires that a compiler "issue a diagnostic" for code that does
>not conform to the standard.  It does not require the compiler to refuse to
>compile the program.  Producing a warning satisfies the ANSI requirement.

But isn't the above code legal C?  Isn't an ANSI C compiler *required*
to compile the code (and required to issue some kind of warning).  My
point is that the above code will be compiled by an ANSI C compiler,
but not by a C++ compiler.

Jamshid Afshar
jamshid@emx.utexas.edu
Newsgroups: comp.lang.c
From: lixxx034@staff.tc.umn.edu (Farong Li)
Subject: Tlink under os/2
Summary: ther is not enough memory for tlink to run under os/2
Keywords: Tlink under os/2
Organization: University of Minnesota
Date: Tue, 26 Jan 1993 03:40:13 GMT

Hi, I run a tlink(ver5.2) under os/2 dos box, it always give a error 
message, say there is not enough memory. However, there is 2 MB DPMI in the 
box stting. I also enable the DPMI_DOS_API.

The bc abd the link under the IDE runs fine.

Any idea?
======================================================================
Farong Li                        |INTERNET: lixxx034@staff.tc.umn.edu|
Dept. of Agri. & App. Econ.      |Tel:      (612)625-9715            |
and                              |Fax:      (612)625-2729            |
Mn Building Research Center      |Tel:      (612)626-7904            |
University of Minnesota          |St Paul, MN  55108                 |
======================================================================
From: pdh@netcom.com (Phil Howard )
Newsgroups: comp.lang.c
Subject: initialized extern variables, coded in 1 file, used in many
Date: 26 Jan 93 01:55:43 GMT
Organization: Netcom - Online Communication Services  (408 241-9760 guest)

I want to define a large set of extern variables and I want to define
them in just one place (one file) so that I don't have any problems
with things out of sync as I change them (changes of type for existing
variables, or adding and deleting variables).

For the above would create variables in a header like:

EXTERN long var1;
EXTERN int var2;

and do

#define EXTERN extern

in all files but the one where they are being exported from.  In that
one file I would do

#define EXTERN

and include the header before the first block.  The choice of symbol
name EXTERN is arbitrary; some other name may be used if consistent.

---------------- NOW HERE IS THE CATCH ----------------

I want to initialize many (its ok to be required to initialize all)
of these variables.  The problem is that initializers are inconsistent
with the extern storage class.  But the initializers would have to be
coded in the same file as the types of the variables are coded, i.e.
the header.  That means the initializers would be there for those modules
using the variables with the extern class.

Also, some of these variables will be very large arrays, and initializing
them via some code would just not be practical.  For example, these arrays
might be a set of default fonts to be used when font files are not specified
or not available.  64000 assignment statements does not make much sense.

I've tried using the omitted storage class in all modules.  This results
in the variables and their initial contents to be exported from all modules.
This results in a lot of large object files and errors in the linker.

Has anyone tackled this organizational problem for C and solved it in some
way?
-- 
/************************************************************************\
| Phil Howard,  pdh@netcom.com,  KA9WGN    Spell protection?  "1(911)A1" |
| "It's not broken... it's just functionally challenged" --Phil and Pete |
\************************************************************************/
Newsgroups: comp.lang.c
From: fred@genesis.demon.co.uk (Lawrence Kirby)
Subject: Re: Conversion of BASIC code to "C" 
Distribution: world
Organization: BT
X-Mailer: Simple NEWS 1.90 (ka9q DIS 1.19)
Date: Tue, 26 Jan 1993 13:11:01 +0000

In article <885@ulogic.UUCP> hartman@ulogic.UUCP writes:

>In article <1993Jan14.000132.1427@microsoft.com> philco@microsoft.com (Phillip
> Cooper) writes:
>> In case you didn't realize
>>it, BASIC is now fully structured (with functions, subroutines, etc..).  
>
>I am tired of hearing this!  I don't care what they claim, but that
>new language with functions, subroutines, etc is NOT BASIC!  They've
>reinvented Algol or Pascal, or something, but >BASIC< is the language 
>with numbers on every line that you find on C64, Atari 800 and old Apples.  
>You know, the one that already has billions of variants even before 
>trying to bring in an entirely new structured language and giving it
>the same name?

What gives those early, crippled, versions of a language more right to be
called BASIC than later, less crippled, ones? As you say, there was no BASIC
standard even in the 'good' old days.

>To call the new language by the same name is a disservice
>to everyone still making use of the real one.

So long as a modern language can still run programs written in the 'real'
language (with at least as much reliability as all the old variants) it has
every right to be called BASIC. If you don't wish to use the newer constructs
that's entirely your own decision.

Back in 1981 I was using a BASIC which supported multi line functions,
ptocedures, local variables and recursion, REPEAT UNTIL loops etc. Any BASIC
these days without such facilities isn't worth bothering about.

-----------------------------------------
Lawrence Kirby | fred@genesis.demon.co.uk
Wilts, England | 70734.126@compuserve.com
-----------------------------------------
Xref: sparky comp.lang.c:20276 comp.lang.c++:19960
From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
Newsgroups: comp.lang.c,comp.lang.c++
Subject: Re: discriminated unions (Re: C/C++ Correctness (was: Re: C/C++ Speed))
Date: 26 Jan 93 20:43:05 GMT
Organization: MAXTAL P/L C/- University Computing Centre, Sydney

In article <1993Jan21.075642.6482@netcom.com> erc@netcom.com (Eric Smith) writes:
>In article <1993Jan21.004105.1335@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
>>	Later I can write a breadth first search.
>>	I dont have to change anything to write the breadth first search.
>>	Its just a global function taking the tree as an argument.
>
>Ok, now I understand.  You want to be able to add functionality to a class
>without changing the class itself nor deriving a new version of it.  

	I'm not sure what you mean by 'add functionality'.

	The public 'member functions' of a class are the axioms. They are
there to map the private data structure of the class to a public interface.
For reasons of efficiency we sometimes have some coupling between
member functions.

	But in general, a function that acts on the public interface
of a class and has no need to know the internal implementation details
should be a global function.

	For example:

	class complex {
		float real, imaginary;
	public:
		float Real () const;
		float Imag () const;
		float Arg () const;
		float Mod () const;
	};

Thats it: now

	complex sin(complex);

Global function==implmentation independent. Making the complex
'sin' a member would be wrong in principle and acceptable only
if a there were a signicant gain in efficiency due to accesssing the private
implementation details.

>Your
>discriminated unions would be helpful toward that goal, but I still don't
>see any overwhelming advantage of that goal.  The only real advantage I can
>see is that you don't have to use a new class name for your new version.
>
>Other than cluttering class name space, are there any disadvantages in
>deriving new classes to add functionality?

	Of course. Unless you adopt a mixin strategy, you cant
use a member function breadth first search on a tree you're
handed which is NOT of the derived type. Thats why you
SHOULD write the searches as global functions, and NOT make
them member functions.

	You want your code to be reusable dont you?

	class complex_with_trig : public complex {
		complex_with_trig sin()const;
	};

	f(complex z)
	{
		...
		complex_with_trig zz=z;
		complex zzz=zz.sin(); // YUK and inefficient
		...
	}

	f(complex z)
	{
		...
		complex zzz=sin(z); // nice
		...
	}

-- 
;----------------------------------------------------------------------
        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
	Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;------ SCIENTIFIC AND ENGINEERING SOFTWARE ---ph:  2 799 8223 --------
Xref: sparky comp.lang.c:20013 comp.lang.c++:19671