HDTenEightyP/NetNews huggingface dataset:
From: cteague@ra.cs.umb.edu (Charles F. Teague II)
Newsgroups: comp.lang.c
Subject: Thanks for linking .BGI files answeres (SUMMARY incl'd)
Date: 3 Sep 92 15:20:19 GMT
Organization: University of Massachusetts at Boston


   Thanks to all who answered my question about linking in BGI files.

   For anyone interested, there are 2 basic ways to use the bgi files,
without copying them to the current directory:

  (1) when calling initgraph(), the 3rd parameter (the string) can be
used to supply a path to the .BGI files.  With some careful use of command
line args, or environment variables, this can be fairly portable, even to
other computers which may not have the same directory structure as you.

  (2) link in the .bgi files directly into your program.  This has the
advantage of removing the problem of finding the .bgi driver, but it increases
the size of your executable (This is what I'm doing for my program).  This
method is described in the text file UTIL.DOC in the \tc directory (which I
feel silly for not reading before asking the net), but I'll summerize:

  First use bgiobj to convert the .bgi file to an .obj file (you may need
to supply a 'public name' if the .bgi file is not one of TC's standard ones).

  Second, if your .bgi driver is not one of TC's standard drivers, you need to
add a prototype at the beginning of your code (or in a header):
void public_name(void); /* unless using the /F option w/ BGIOBJ */
extern int far public_name[]; /* if using the /F opt w/ BGIOBJ */
For the above prototypes, public_name is the public name BGIOBJ said in its
output, without the initial underscore ('_').  Warning:  this public_name is
NOT a function/array, it's just there so the linker can find the bgi code.

  Third, BEFORE calling initgraph, you need to register the bgi object with:
registerbgidriver( public_name );
You should probably catch the return value and hand it to initgraph as the
gdriver parameter.

  That's it.  A similar procedure works with fonts, using registerbgifont()
instead of registerbgidriver().

  Once again, I want to thank those of you who replied,
--
Charles F. Teague II  Net:cteague@cs.umb.edu  Real:33 Sidney Ave, Lynn MA 01902
+------------------------------------+-----------------------+----------------+
| Computers are so powerful because  | "Don't do what I SAY, | 'lush' CS 1993 |
| they do whatever you tell them to. |  do what I mean!!!!"  | TKE-zm sn 603  |
+------------------------------------+-----------------------+----------------+
Hi!  I'm a replicating .sig virus!  Join in the fun and copy me into yours!
Newsgroups: comp.lang.c
From: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
Subject: Re: True Portability?
Organization: Computer Science, University of Melbourne, Australia
Date: Mon, 31 Aug 1992 19:53:41 GMT

jlnance@eos.ncsu.edu (JAMES LEWIS NANCE) writes:


>In article <Aug31.145702.60242@yuma.ACNS.ColoState.EDU>, shafer@CS.ColoState.EDU (spencer shafer) writes:
>|> 
>|> With 'C's touted portability, is it unreasonable for a user to expect
>|> a vendor to offer "source code compatibility" across multiple hardware
>|> platforms?

No, that is quite reasonable.

>|> In other words, I would like to take the same program and
>|> compile it on different machines and obtain the EXACT same results.
>|> Keep in mind this includes POSIX, any API's for communications stacks
>|> and for process to process communications.  Is it too much to expect?

So long as you stick to writing portable code, it is a reasonable expectation.

>|> Could the API's be different - parameter order, encoding, etc.?  Could
>|> the runtime libraries be different?
>|> How can a user require a vendor to provide this? (and then verify it?)

Users can insist that their vendor's compiler comply with various standards,
eg. ANSI/ISO C, POSIX, etc. If your vendor doesn't provide (say) ANSI C, then
you can find another vendor that does!
Usually there is no way of verifying that the vendor's compiler is
strictly compliant, other than trying it on a lot of programs.

>|> I'm interested in any opinions or experiences.
>
>It is easy to write nonportable code in C or in any other language, but it you

Just to nitpick a little: there ARE other languages where it is NOT easy to
write non-portable code in.

>stick to the standard libraries, and do not use anything that the ansi standard
>says is implementatin specific, your programs should be fairly portable.
>If you do graphics, then things get tricker.  If you manipulate the graphics 
>hardware directly from C, then you will not be protable at all.  If you use
>something like an X windows server to provide your graphics interface, then you
>will be portable.
>
>If you write binary files and expect to share these between machines,
>or if you use network connections between machines, then you have to
>wory about wheather a machine is big or little endian, but if you
>explicitly take this into account, you can still be portable.

No, you won't.
Basically binary files are not portable.
(Code to read/write binary files can be portable, but the files themselves
are not.)

-- 
Fergus Henderson             fjh@munta.cs.mu.OZ.AU      
This .signature virus is a self-referential statement that is true - but 
you will only be able to consistently believe it if you copy it to your own
.signature file!
From: dave@cs.arizona.edu (Dave Schaumann)
Newsgroups: comp.lang.c
Subject: Re: Password encryption?
Keywords: password, encryption
Date: 4 Sep 92 02:37:28 GMT
Reply-To: dave@cs.arizona.edu (Dave Schaumann)
Organization: University of Arizona

In article <julian.715516516@sun-1>, julian@sun-1 (Julian Hansen) writes:
>I need to do some password encryption and maybe data encryption to. Anyone
>out there like to help me.

Try posting to sci.crypt.

-- 
Dave Schaumann			dave@cs.arizona.edu
From: wenner@einstein.eds.com (Rich Wenner)
Newsgroups: comp.lang.c
Subject: Re: printf question
Date: 28 Aug 92 18:09:32 GMT
Organization: Electronic Data Systems

In article <kimcm.714943581@login.dkuug.dk> kimcm@login.dkuug.dk (Kim Chr. Madsen) writes:
>eht@coos.dartmouth.edu (Edward H. Truex) writes:
>
>>I am trying to format a hexadecimal number whose width 
>>is always a constant - like 
>
>>	printf("%04x\n", address );
>
>try to use the variable width specification method:
>
>	printf("%0*x\n",4, adress);
>
>an asteriks in the width specification is taken as a variable that
>must be taken from the arguments and be evaluated at runtime...

The above will work just fine, but if you have a full ANSI compiler, the
syntax ...

#define HDPI "4" /* Hex Digits Per Int */

	printf( "%0" HDPI "x\n", address );

... will also work, provided that your constant is defined as a character
string literal.  The ANSI preprocessor will see character string literals
with no intervening symbols other than whitespace, and will concatenate
them into a single string.  This is the same trick you can use for ...

	fputs( "This is a really long message to write out to a file, but "
		"now, thanks to ANSI, I don't have to do that hokey crap "
		"of putting backslashes in awkward places or doing a bunch "
		"of strcats.", file_ptr );

And if you have read this far, you surely won't mind one more irrelevant
remark ;-)  Using this syntax on the original problem will save you some
time because the format is evaluated at compile time instead of run time.
Depending on your hardware platform, this may actually amount to several
nanoseconds!

-- 
Rich Wenner               | It is by the goodness of God that in our country we
wenner@pascal.tsd.eds.com | have those 3 unspeakably precious things:  freedom
                          | of speech, freedom of conscience, and the prudence
#include <stddisclaimer.h>| never to practice either of them.      Mark Twain
From: svleest@jobim.crhc.uiuc.edu (Steve VanderLeest)
Newsgroups: comp.lang.c
Subject: Re: random number generation
Date: 28 Aug 1992 13:43:24 GMT
Organization: Center for Reliable and High-Performance Computing, University of Illinois at Urbana-Champaign
Distribution: world
NNTP-Posting-Host: jobim.crhc.uiuc.edu

In article <1992Aug27.133805.21292@u.washington.edu>, scipio@milton.u.washington.edu (jim lee) writes:
|> Can someone help me?  I need some coding that will generate random
|> numbers.

Most decent C libraries have two routines called rand() and srand() which will
do this for you.

srand(seed) 	takes a seed number to start up the pseudo-random sequence
rand()		returns a random number once srand() has been used to seed
		the sequence

If you do not have access to a decent library, the algorithm is rather simple.

	r[0]   = MULTIPLIER*seed + ADDER
	r[n+1] = MULTIPLIER*r[n] + ADDER

where MULTIPLIER is of the form 1+4k, k being an integer
and ADDER is an odd integer.  Make MULTIPLIER and ADDER large numbers
or the sequence increases at first.  Also, all operations are done
mod the size of r[0].  That is, you must prevent the adds and multiplies 
from holding on to any carry or overflow.

If the same seed is chosen, the same sequence will be repeated.  The trick 
is to use a different seed each time.  Best way is to derive seed from the 
system clock.  If no clock is available, then you must input a different 
seed each time from another source.
Newsgroups: comp.lang.c
From: osymg@Ercvx1.erc.montana.edu (Marcus Giese)
Subject: LALR grammar for "C"
Reply-To: osymg@Ercvx1.erc.montana.edu (Marcus Giese)
Organization: NEWSRDR-testing
Date: Sat, 29 Aug 1992 19:40:53 GMT

       Hello, I'm looking for a "C" LALR grammar definition.  Obviously
I'd prefer one in a "yaccable" form, but any form would do.  This might
not even be the right list for this question, so please point me in the
right direction.  If you know of any ftp site, or mailserver (or have
the definition just lying around :-), I would appreciate your mail...

                                thanks,
                                        Marcus

|Marcus Giese|osymg@cs.montana.edu|osymg@terra.oscs.montana.edu|(406)994-3932|
------------------------------------------------------------------------------
"If they're selling elephants two for a quarter, that's a great bargain.
 But only if you have a quarter - and only if you need elephants." (D.Dinkins)
From: dwiseman@spsd630a.erim.org (Dave Wiseman)
Newsgroups: comp.lang.c
Subject: Re: C vs. FORTRAN
Date: 4 Sep 92 11:41:58 GMT
	<1992Sep4.075353.16079@itnsg1.cineca.it>
Organization: Environmental Research Institute of Michigan, Ann Arbor, Michigan
In-reply-to: ditolla@itnsg1.cineca.it's message of Fri, 4 Sep 1992 07:53:53 GMT


Thanks to all that responded via E-mail and comp.lang.c.  The real answer,
of course, turned out that the FORTRAN compiler optimized away everything.
I modified the programs to sum up the computed sines and cosines, and print
the sum at the end.  The two programs now take a comparable amount of time 
in each language.

Of course, now I'll have to bite the bullet on all of the computations.  Since,
in general, I won't have comman angle increments, I may elect to precompute
a look-up table to use.  Thanks again to all who responded!

--
David Wiseman              dwiseman@erim.org
Environmental Research Institute of Michigan
From: torek@horse.ee.lbl.gov (Chris Torek)
Newsgroups: comp.lang.c
Subject: Re: main()
Date: 3 Sep 1992 16:15:31 GMT
Organization: Lawrence Berkeley Laboratory, Berkeley
Reply-To: torek@horse.ee.lbl.gov (Chris Torek)
NNTP-Posting-Host: 128.3.112.15

In article <6700001@tisdec.tis.tandy.com> doug@tisdec.tis.tandy.com writes:
>Actually main() is defined as
>
>  int main(int argc, char **argv, char *envp);

Such a declaration is in violation of ANSI standard X3.159-1989, i.e.,
does not conform to the C standard.  Note, however, that any system can
add extensions to the standard, provided that the system still accepts
strictly conformant programs.  This extra `envp' parameter is presumably
just such an extension.  Thus, if you declare and define main() in a
conformant fashion, such as

	int main(void);
or	int main(int argc, char **argv);

the system *must* accept it or else fail to meet the standard.

>Now have said all that I should point out that I currently work on a
>non-Unix system (it's not DOS either, it's much worse) where the system
>does know what main() looks like.  If I don't declare main() with exactly
>the return value and parameters it expects then the linker will spit out
>some warning messages.

Any system is free to emit spurious warnings, including this one.  I
would consider this a bug myself, but the right thing to do (other than
fixing the linker---main() is a special case and must be treated
specially; obviously whoever wrote this code forgot to do so, or wrote
it before the standard existed) is to ignore the linker warning.

>To avoid these I declare everything, including envp, at which point
>the compiler spits out its own warning messages telling me that I
>declared but didn't use some parameters.

Given that you have to put up with one warning or another until you get
the linker fixed, you might as well use a strictly conformant main().
-- 
In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 510 486 5427)
Berkeley, CA		Domain:	torek@ee.lbl.gov
Xref: sparky comp.lang.c:13180 comp.lang.c++:13263 comp.os.msdos.apps:4629 comp.os.msdos.programmer:9025
From: cee1@ra.msstate.edu (Charles Evans)
Newsgroups: comp.lang.c,comp.lang.c++,comp.os.msdos.apps,comp.os.msdos.programmer
Subject: Should I buy BC++ 3.1??
Date: 3 Sep 92 17:42:07 GMT
Organization: Mississippi State University

Well, info from customer-support@borland.com says the educational price
for BC 3.1 is $139.99. However, I was cruisin' thru the university bookstore/
computer place and they have it for $99.00. Ok.

I am running Borland C++ 2.0. I am trying to learn C++ a whole bunch harder
than C. I have been teaching myself C since Jan 91. ANyway, I do programs 
here and there.. with graphics and semi-simple stuff, not quadruple binary
trees etc etc. So I am wondering, is it worth my $99? I know that v. 3.1
is compatible with WIn 3.1 (I'd lvoe to learn how to program in Windows) and
is fully AT&T Cfront whatever 3.0 compatible etc. Templates et al.

Well right now I have Turbo C++ 1.02 on my shelf. Then I would have Borland
C++ 2.0 on my shelf... what can I do with all these things on my shelf.. it
just looks like a waste to me. Spend a 100 bucks for each pop and then what..
I guess I could find someone to buy them (no flames on the transferrablity
of software licencses, selling, giveing etc..) wouldn't they? That's my main
hesitant to upgrading.. so much on the shelf.

Lastly, I read/heard news that MS-DOS 6.0 (just MSDOS 5.0 + utilities as
INFO WORLD has said) will be out soon, no biggie.. However they also said that
(I think) DOS 7.0 will be a COMPLETE rewrite redo everything. Should I wait?

any pointers or pointers to pointers to int would be helpful.

chuck

-- 
+--------------------+-----------------------+------------------------+
|  Charles E. Evans  |  cee1@ra.msstate.edu  |  All things are green  |
|    iDLE CHATTEr    |  cee1@MSSTATE.BITNET  |  unless they are not.  |
+--------------------+-----------------------+------------------------+
Newsgroups: comp.lang.c
From: dkeisen@leland.Stanford.EDU (Dave Eisen)
Subject: Re: main()
Organization: Sequoia Peripherals, Inc.
Date: Thu, 3 Sep 92 19:12:08 GMT

In article <1383@uknet.ac.uk> tlg@uknet.ac.uk (Tim.Goodwin) writes:
>In article <1992Sep3.160001.13782@lclark.edu> harrison@lclark.edu
>(Mark Harrison) writes:
>>thought of it before.  But two people have now told me to try it with -A
>>and -P.  Why?  I don't really need to satisify my curiosity about 'void
>>main()'.  So is there another reason I would want these switches?
>
>It seems that the readers of this group are interested in C, as defined by
>the ANSI/ISO standard, and not in other languages which happen to look
>like C (as, for example, the language which your compiler compiles).
>
>There are some, perhaps, who are overkeen to correct those who do not share
>this fascination with the standard.  But they are not trying to "score a
>point off you", merely attempting to disseminate accurate information.

There is a reason the folks here are so keen on coding in standard
conforming ways. Most of us have had the experience of having to
port code that "obviously would never be ported" and have learned
the hard way the value of sticking by the rules. Or we have had
to maintain code that was written to the particular idiosyncrasies
of a given compiler and had to keep using that same crufty old compiler
even though the company that wrote the compiler went out of business.

So sure, if your code is so hardware dependent that you know you 
will never switch platforms, code however you want. But you are
locking yourself into the exact platform and development tools
you are using now. And this decision might start to look foolish
4 or 5 years down the road.




-- 
Dave Eisen    dkeisen@leland.Stanford.EDU   Sequoia Peripherals: (415) 967-5644
          	Some of my best friends are men.
        --- Lisa Nee in "American Women Deserve a Tax Break."
Newsgroups: comp.lang.c
From: RICHARD@CLYDE.ttt.kth.se
Subject: Re: pointer to multi D array. How?
Organization: Department of TeleTransmission Theory
Date: Thu, 27 Aug 1992 17:19:15 GMT

In article <1992Aug26.050053.114348@zeus.calpoly.edu> clin@zeus.calpoly.edu (Chihtsung Jeffrey Lin) writes:


   Can someone help me with this? I just started programming in C, I've been
   programming in ADA for a while. How do you declare a pointer to a
   multi-dimensional array? here is what I did.

   int A[5][5]:={1,2,3,......}, **x;

Make that:

 int A[5][5]={1,2,3,.....}, *x;

Then this will work:

   x=A;

You see, an array (any dimension) is IN MEMORY really just a single vector.
To make it look like an array, there is some calculations involved to index
the right memory location. In fact, when you use the pointer x above, you'll
have to do those calculations yourself:

 int foo = x[2*5+1];  /* access A[2][1] */

or

 int foo = *(x+2*5+1); /* "Real" pointer arithmetic :-) */

   I thought a M-D array IS a pointer to pointers. If not, how can I make 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;

   pointer point to that array? The only reason I want to use a pointer is so
   that I can change the array's values inside functions. God I hate C (just my
   opinion :).

Eh? Why don't you define your function like this?

 int funky(int foo[5][5])
 {
  /* do whatever you whish withh foo */
 }

 ...

  result=funky(A);

In fact, the argument is really a pointer, but the calculations to get the
index right is implied in the function funky()!

   Thanks.

You're very welcome.
--
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!
! Richard Levitte, System manager       ! tel: int+46-8-790 64 23           !
! Royal Institute of Technology         ! fax: int+46-8-791 76 54           !
! Department of Teletransmition Theory  ! Internet: richard@ttt.kth.se      !
! S-100 44 Stockholm, Sweden            !                                   !
!---------------------------------------------------------------------------!
Newsgroups: comp.lang.c,comp.unix.programmer
From: hp@vmars.tuwien.ac.at (Peter Holzer)
Subject: Re: I/O With Unix/C
Organization: Technical University Vienna, Dept. for Realtime Systems, AUSTRIA
Date: Thu, 27 Aug 1992 19:02:27 GMT

max@underg.UUCP (Max Cray) writes:

>I am trying to do the most basic file I/O on a couple of unix machines (HP835,
>and Sequent S27), and I can not get it to work. For example:

>#include <stdio.h>
>main()
>{
>    int c;

>    while (c = getchar() != NULL)
>        putchar(c);
>}

>On a DOS machine you just compile it, and it works. 

I very much doubt that. Your program contains 2 serious bugs. Firstly,
it will not stop at EOF but after the first NUL character it receives
(i.e. probably never). And it will print a character '\1' for every
character it receives (And '\1' is non-printing on many systems, so you
probably won't see anything).

>When I compile it on
>a unix machine, it compiles and runs, but I can't seem to redirect input
>and output through it.

>ls -l | myfilter > outfile.tmp

>If I type the following command it runs, but it still expects the I/O to
>come from the keyboard, and go to the screen.

How large was outfile.tmp after you killed the program?

-- 
|    _  | Peter J. Holzer                       | Think of it   |
| |_|_) | Technical University Vienna           | as evolution  |
| | |   | Dept. for Real-Time Systems           | in action!    |
| __/   | hp@vmars.tuwien.ac.at                 |     Tony Rand |
Newsgroups: comp.lang.c
From: darcy@druid.uucp (D'Arcy J.M. Cain)
Subject: Re: Only one char (on UNIX 386)
Date: Mon, 31 Aug 1992 12:15:16 GMT
Organization: D'Arcy Cain Consulting
Keywords: char

vaso@generic.uucp (Vaso Karac) writes:
>I have problem with get only one character from keyboard,
>without using <return>.

The FAQ is on its way.

-- 
D'Arcy J.M. Cain (darcy@druid.com)  |
D'Arcy Cain Consulting              |   There's no government
Toronto, Ontario, Canada            |   like no government!
+1 416 424 2871          DoD#0082   |
Newsgroups: comp.lang.c,comp.std.c