HDTenEightyP/NetNews huggingface dataset:
From: julian@sun-1.cs.uct.ac.za (Julian Hansen)
Newsgroups: comp.lang.c
Subject: Password encryption?
Summary: Anyone got source for password encryption?
Keywords: password, encryption
Date: 3 Sep 92 10:35:16 GMT
Organization: Computer Science Department, University of Cape Town

Hi world,

I need to do some password encryption and maybe data encryption to. Anyone
out there like to help me. Some code would be nice and maybe a few pointers
on what not to do (and what to do). Any help would be most appreciated.

Tank u veddy mush (hic) I apreshtia,.. apreeshet, apreesheate it.

julian

----------------------------------------------------------------------------
                                                   VVVVVVV
                                                  /       \
Julian Hansen                                    / _     _ \   I'm Back
University of Cape Town                          |/_\   /_\|  /
South Africa                              ____   ||o|   |o|| / ____
email: julian@sun-3.cs.uct.ac.za   -------VVVV---|---\ /---|---VVVV------
                                                      U 
----------------------------------------------------------------------------
Newsgroups: comp.lang.c,comp.os.msdos.programmer
From: rca@csd4.csd.uwm.edu (Robert C Allender)
Subject: WANTED: Code to search DOS directory/subdirectories
Originator: rca@csd4.csd.uwm.edu
Organization: Computing Services Division, University of Wisconsin - Milwaukee
Date: Thu, 27 Aug 1992 04:44:45 GMT

I'm trying to find a reasonable block of code that will search through a DOS 
directory using Turbo C 3.0 in DOS mode.  I had what I thought was a good 
source listing in the C User's Journal - February 1992 edition, but it won't 
compile to save my life.  Has anyone else tried this code?  Does anyone have
a good program that does this?  All I need to do is search every file on a 
drive and check the date stamp.  If it's greater than x, set the archive bit 
to on.  Pretty simple stuff.  

Just so I don't get anyone upset, I *did* RTFM.  As a matter of fact, I called 
tech support because the FM doesn't give all the details about the 
_dos_findfirst() and _dos_findnext() functions that are supposed to do this 
kind of stuff. 

eg.

     { ...

       struct find_t ffblk;
       int done;
       printf("Directory of C:\\\n");
       done = _dos_findfirst("C:\\*.*",_A_SUBDIR,&ffblk);
       while(!done) 
       {
          printf(" %s\n", ffblk.name);
          done = _dos_findnext(&ffblk);
       }
       return 0;

     } ...

the _A_SUBDIR is supposed to return only DOS subdirectory entries, however it
seems to (as do the other alternatives) also return normal files that are  in
the same directory with the directory entries.

If anyone can help, I'd really appreciate it.

-Rob Allender
 rca@bfs.uwm.edu -or-
 rca@csd4.csd.uwm.edu 





--------------------------------------------------------------------------
| Robert C. Allender    |  "Exactly!" said Deep Thought. "So once you do | 
| rca@csd4.csd.uwm.edu  |  know what the question actually is, you'll    | 
| rca@bfs.uwm.edu       |  know what the answer means."                  | 
|                       |        -The Hitchhiker's Guide to the Galaxy   | 
--------------------------------------------------------------------------
--
From: sakamoto@sm.sony.co.jp (Tomohiko Sakamoto)
Newsgroups: comp.lang.c
Subject: Where is an ANSI-C scanf funcion?
Date: 3 Sep 92 07:10:03 GMT
Reply-To: sakamoto@sm.sony.co.jp
Organization: Workstation Div., Supermicro Systems Group, Sony Corporation

main() {
	int n; float f; char s[20];
	f = 0.0; *s='\0';
	n = sscanf("2.7a-xyz", "%f %s", &f, s);
	printf("n=%d, f=%.1f, s='%s'\n", n, f, s);
	f = 0.0; *s='\0';
	n = sscanf("2.7e-xyz", "%f %s", &f, s);
	printf("n=%d, f=%.1f, s='%s'\n", n, f, s);
}
----------------------------------------------------------
Borland C++ Version 2.0, Microsoft C Version 5.10, and cc on 4.3BSD:
	n=2, f=2.7, s='a-xyz'
	n=2, f=2.7, s='xyz'

cc on SunOS 4.1.2 and cc on SVR4:
	n=2, f=2.7, s='a-xyz'
	n=2, f=2.7, s='e-xyz'

But ANSI C (ANSI X3.159-1989) p.139 says:
	n=2, f=2.7, s='a-xyz'
	n=0, f=0.0, s=''	/* "2.7e-" fails to match "%f" */

Can anybody explain this?

--
sakamoto@sm.sony.co.jp
From: gilpin@iscsvax.uni.edu
Newsgroups: comp.lang.c
Subject: Re: New Comer - Please Help !
Date: 26 Aug 92 07:50:03 -0500
Organization: University of Northern Iowa

> In article <1992Aug25.235044.29224@nuchat.sccsi.com>, michael@nuchat.sccsi.com (Michael Bentley) writes:
> > In article <1992Aug25.171317.8124@samba.oit.unc.edu> Ketan.Deshpande@bbs.oit.unc.edu (Ketan Deshpande) writes:
> >>In article <1992Aug25.000613.3610@geovision.gvc.com> pt@geovision.gvc.com writes:
> > 	[> question about library functions deleted for brevity <]
> >>>I would suggest you actually _buy_ TurboC instead of pirating it, and then
> >>>RTFM.  There is a huge library of functions already there, and FileExists
> >>>As for mouse libraries, sorry - my TurboC manual doesn't mention it.
> >>
> >>I don't see how Doug's letter leads to Paul's statement about _buying_ TurboC.
> >>Can you help me out?
> >>Ketan.
> > 
> > I believe that Paul is assuming (not totally without reason - *I* thought
> > the same thing) that if Doug had actually bought the product, he would
> > have noticed that there were several manuals included....  One of them
> > has "RUN-TIME LIBRARY * GLOBAL VARIABLES" (borland's caps lock, not mine)
> > written down the spine...
> > 
> > 
> > -- 
> > +============================================================+
> > |  Michael S. Bentley (Looking for a way back to California) |
> > |  VoiceNet : (713) 558-2349                                 |
> > |  E-mail   : michael@nuchat.sccsi.com                       |


  I don't know about your situations, but at my university the site license
with Borland allows anybody on campus to run any of the Borland compilers
(either on networks, or on stand-alone micros).  The manuals, however, cost
extra.  I don't teach programming using C, but if I did I think I would
probably develop some in-house documentation to give students rather than
insisting that they spring for the complete manual set.  Obviously serious
programmers will need it.

--------
Andy Gilpin, Dept. of Psychology,     |Internet: gilpin@uni.edu
Univ. of Northern Iowa, Cedar Falls,  |Phone: (319) 273-6104
Iowa 50614-0505                       |
Newsgroups: comp.lang.c
Subject: Obfuscated C
From: stern6@husc10.harvard.edu (Michael Stern)
Date: 26 Aug 92 20:53:09 GMT
Distribution: na

Where would I find past winners of the obfuscated C contest
archived? (The code, not the programmers).

Thanks,
Stern
Newsgroups: comp.lang.c
Subject: P6LIB for C??
From: robertson@physc1.byu.edu
Date: 23 Aug 92 12:54:25 -0600
Distribution: world
Organization: Brigham Young University

  Hi,

  I have recently begun programming in c instead of fortran.
  Is there some plot utilities that I can call from my c
  program similar to P6lib for fortran.  I would like copies
  of these utilities to work to make .tek files from a Vax,
  OS/2, and Unix.

  I work at home on an OS/2 system and need my program to
  be easily portable to the VAX and UNIX workstations at
  school.  It would be nice if I could find a library that has
  versions for all three systems.  (OS/2 and Unix at the least)

  Thanks
        Jim Robertson      robertson@physc1.byu.edu
Newsgroups: comp.lang.c
From: jle9162@zeus.tamu.edu (ECKHARDT, JASON LEE)
Subject: GCC for DOS
News-Software: VAX/VMS VNEWS 1.41    
Organization: Texas A&M University, Academic Computing Services
Distribution: usa
Date: Wed, 26 Aug 1992 02:56:00 GMT

  I just installed GCC for DOS and am having trouble compiling anything.
I unzipped djdev107.zip, djgcc222.zip, djgas138.zip according to instructions
and set the environmental variables.
Then I try "gcc sample.c" and all I get is :
"unrecognized file type 0x6923"

What does this mean? It doesnt't even try to compile or anything.
I've used GCC for unix for ages and have never seen this error.

Thanks, jason.

jle9162@venus.tamu.edu

Newsgroups: comp.lang.c
From: dkeisen@leland.Stanford.EDU (Dave Eisen)
Subject: Re: main()
Organization: Sequoia Peripherals, Inc.
Date: Fri, 4 Sep 92 16:13:36 GMT

In article <MJN.92Sep4010149@pseudo.uucp> mjn@pseudo.uucp (Murray Nesbitt) writes:
>
>>C books that have ``void main'' are broken and are probably only useful
>>for heating purposes. 
>
>I hope this doesn't include my copy of K&R, in which most example
>programs have no explicit return value from main().  This is
>functionally equivalent to ``void main()''.

No, it is not functionally equivalent to void main (). There is
a difference between a function of type integer that has no
return statement (i.e., one that returns garbage) and a function
of type void. The compiler is free to use a different calling 
sequence for functions of type void than it does for functions
of type int, it is *not* free to do the same for functions of
type int which don't have an explicit return statement (modulo
the usual stuff about the as if rule).

Still, not having an explicit return statement from a function
of type int *whose return value is being used* is not kosher. And
main is just such a function. I would hope K&R would not do this.



-- 
Dave Eisen    dkeisen@leland.Stanford.EDU   Sequoia Peripherals: (415) 967-5644
      There's something in my library to offend everybody.
        --- Washington Coalition Against Censorship
From: wade@nb.rockwell.com (Wade Guthrie)
Newsgroups: comp.lang.c
Subject: Re: Most difficult part of learning C?
Date: 25 Aug 92 19:03:04 GMT
Organization: Rockwell International


Without a doubt, *understanding* pointers.  No, I mean R E A L L Y understanding them.
I got the point about them containing addresses and all, but when one combines that
with the data types to which they point so that one can sort out things like:

	a = (char	*(*foo)(int *(*bar)[], float **bletch)) b;

(I know that this is pretty sick :->)  But this takes some time.

Ugly stuff aside, I think I started to understand pointers the first time I looked
at a scanf statement and realized what it was trying to do.  (And I think I started
to have a pretty good feel for C when I stopped using 'scanf').

Wade
wade@nb.rockwell.com
From: alan@elroy.Jpl.Nasa.Gov (Alan S. Mazer)
Newsgroups: comp.lang.c
Subject: Have you taken a C class?
Date: 26 Aug 92 15:23:50 GMT
Distribution: na
Organization: Image Analysis Systems Group, JPL

I'm scheduled to teach a class in "Advanced C", the purpose of which is to
address programming techniques beyond what's covered in the normal intro
class.

So.  If you've taken a C class (say at a community college), I'd be interested
in hearing what you felt the class left out or what they _didn't_ tell you or
what you would really like to be learning next.  

Some examples:  X programming, using system calls, ...

Thanks.  Please e-mail if possible.
-- 
 
-- Alan                        # Mountain Dew and doughnuts...
   ..!ames!elroy!alan          # because breakfast is the most important meal
   alan@elroy.jpl.nasa.gov     # of the day.
Organization: University of Maine System
Date: Sunday, 30 Aug 1992 05:46:50 EDT
From: <IP25179@portland.caps.maine.edu>
Newsgroups: comp.lang.c
Subject: Re: Freedom of Speech (was: Mister Ed Nilges)
Distribution: usa
 <1992Aug27.143515.545@Princeton.EDU> <BtnLup.Irz@NCoast.ORG>
 <1992Aug27.212216.18631@Princeton.EDU> <27AUG199222080334@zeus.tamu.edu>

  [Text of extremely nasty put down of someone who used more parens than were
  strictly speaking necessary deleted.  Suffice to say it was way out-of-
  line.]

  Keep in mind also that there are many versions of C (and C++) out there.
  Some of us have to program in several of them, and NOT ALL OF THEM HAVE THE
  SAME OPERATOR PRECEDENCE.

  So, given that I have limited amounts of time in my life, do I (A) memorize
  all the different operator precedences?  Or do I (B) just overuse a few
  parens and let the compiler take care of them?

  Some of us will answer (A), true, but I answer (B) and let it go at that.

  If your seminar is as insulting as the post you used to promote it, remind
  me to avoid it like the plague.

  -Iain Odlin
Xref: sparky comp.lang.c:13069 comp.lang.pascal:5153
From: bobb@vice.ICO.TEK.COM (Robert Beauchaine)
Newsgroups: comp.lang.c,comp.lang.pascal
Subject: Re: Pascall Typed Files
Date: 1 Sep 92 17:26:50 GMT
Followup-To: comp.lang.c
Organization: Tektronix, Inc., Beaverton,  OR.

In article <qhzeph6@Unify.Com> tsv@dbrus.Unify.Com (Tim Vannaman) writes:
>OK, since I can't put pascal obj's into my c code, how can I read a typed file
>created by pascal into my C program?  (Turbo C & Pascal)
>
>ex.
>  In pascal :
>
>  Type
>     scuz = record
>	      Player string[25];
>	      Age    integer;
>	      Money   float;
>	    end;
>     
>  Var 
>    fil : File of Scuz;
>
>
>If I load the file full of data, how would I go about reading and re-writing it
>in C?  I tried getting a hex dump of the file, but it didn't make any sense.
>

  As another poster has mentioned, TP strings are different than C
  strings in that the dynamic length of the string is placed at byte
  0, rather than having a null termination.  You should read the 26 
  bytes into memory and then massage the Pascal string into C format.

  Reading integers is straightforward; they are completely
  compatible between the two languages.

  Floats do not exist in Turbo Pascal, at least not by that name.
  The C float type is a the IEEE 4 byte real, which is called a
  "single" in Turbo Pascal.  If you need double precision, then both
  languages use the IEEE double type. 

  An equivalent structure in C would look like 

  struct Scuz {
    char player[26];
    int  age;
    float money;
  };

  and the actual equivalent TP record would be as you listed, with
  the exception of float being replaced with single.

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ 

Bob Beauchaine bobb@vice.ICO.TEK.COM 

"If I have to resurrect you, I'll resurrect you, whether you like it
or not!"
	 Paul to Jesus, _The_Last_Temptation_of_Christ_

"For dying is not to be feared--it is the final comfort.  As we all
learn, eventually."

  --Robert Heinlein
From: darcy@druid.uucp (D'Arcy J.M. Cain)
Subject: Re: strcpy implementation question
Date: Wed, 26 Aug 1992 02:40:06 GMT
Distribution: comp
Organization: D'Arcy Cain Consulting

pausch@saaf.se (Paul Schlyter) writes:
>In article <1992Aug22.132132.13813@iecc.cambridge.ma.us> johnl@iecc.cambridge.ma.us (John R. Levine) writes:
>>But it doesn't say "(including the terminating null character and any other
>>garbage convenient for the compiler implementer)".  You have to stop at the
>>null byte.
>Even on a machine with word addressing, where each string is very likely to
>occupy an integral number of machine words?

Sure, why not?  That's an implementation detail.  It has to act as if it
did the right thing.  The following program should print "Hello World" to
the output:

#include <stdio.h>
#include <string.h>
int main(void)
{
  char buf[] = "      World"; /* that's 6 spaces */
  char hello[] = {'H', 'e', 'l', 'l', 'o', 0, 'X', 'X' };
  strcpy(buf, hello);
  printf("%s %s\n", buf, buf + 1 + strlen(hello));
  return(0);
}

Now if the machine is a word addressable one and the word size is 4 then
it might seem more efficient to copy the hello string in two word moves
but to do so would cause the program to print "Hello XXrld" instead.  The
implementor *must* guarantee that the string is set correctly by doing
the necessary ANDs and ORs.  Seems to make a good case for four byte
chars on such a machine.

Of course one would have to wonder about code that was bitten by something
like this.  :-)

-- 
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   |
Lines: 4
Date: Wed,  2 Sep 92 09:40:52 MDT
Newsgroups: comp.lang.c
Subject: Graphics Gems Books
Distribution: usa
Organization: Brigham Young University, Provo UT USA
From: gaow@bones.et.byu.edu (Jinsong Gao)

Hi.  I have heard about Graphics Gems Books (I & II and recently III).
Could anyone tell me the publisher of these books?  

Thanks.
From: jos@and.nl (Jos Horsmeier)
Newsgroups: comp.lang.c
Subject: Re: Copying file of int to 2-d array
Date: 30 Aug 92 13:37:25 GMT
Organization: AND Software BV Rotterdam

In article <chans.715161329@marsh> chans@marsh.cs.curtin.edu.au (Sean Chan) writes:
|I'm trying to read a file, containing integers into a 2-D array that has
|been dynamically allocated. However, I think I'm doing it wrong. When I
|print out my array to screen, the values differ...yes, I am a beginner
|in C :)
|
|Here my code :-

[ deleted most of the code, but here's the trouble maker: ]

|   int **array, counter, r, c;
|   FILE *infile;
|
|   /* allocate space for array */
|   array = (int **) malloc (98 * sizeof (int *));
|   for (counter = 0; counter < 98; ++counter);
|       array = (int *) malloc (98 * sizeof (int *));
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

|I like to add that this code seems to work perfectly fine ALL THE TIME
|on UNIX, but works at random on BORLAND C++ Ver 2.0

Boy, you were lucky that this thing ever survived on a UNIX box. ;-)
Just look what's happening in the code above. First the pointer value 
of the allocated memory (the vector for all the matrix rows) is assigned
to the variable `array'. Inside the loop, you assign 98 different values
to the _same_ variable `array', destroying (or losing) the previous values.
Didn't the compiler warn on this? `array' is an int**, but it gets a
int* value assigned to it ...

Change it into this:
	
       array[counter] = (int *) malloc (98 * sizeof (int *));

kind regards,

Jos aka jos@and.nl
From: dave@cs.arizona.edu (Dave Schaumann)
Newsgroups: comp.lang.c
Subject: Re: Help: problem codes
Date: 31 Aug 92 16:54:21 GMT
Reply-To: dave@cs.arizona.edu (Dave Schaumann)
Organization: University of Arizona

In article <1992Aug31.003108.9782@uoft02.utoledo.edu>, qding@uoft02 writes:
>I have a C program (shown below) which shows error
>of >> Illegal structure operation in fuction sum. 
>
>
>typedef double tuple[4];
>
>typedef struct vector {
>	integer      dim; /* the dimension of the vector */
>	tuple        component; /* the array of components */
>} vector; /* the definition of type vector */
>
>/* function sum */
>vector sum(vector a, vector b)
>{
>   integer      i;
>   sum.dim = a.dim;
>   for (i = 1; i <= a.dim; i++)
>   sum.component[i] = a.component[i] + b.component[i];
>} /* function sum */

Let me guess: you're a Pascal programmer switching to C, right?  In C,
a function name refers to the function, and nothing else. (Unlike Pascal,
where it also refers to a magic return value variable). (Also note that
there is no type called `integer' in C, and that all arrays in C start at
index 0).

Try this:

vector sum( vector a, vector b ) {

  vector c ; int i ;

  c.dim = a.dim ;
  for( i = 0 ; i < a.dim ; i++ )
    c.component[i] = a.component[i] + b.component[i] ;

  return c ;
  }

-- 
The security of the Enterprise is of Paramount importance.
                        -Jean Luc Picard, stardate 45965.3
From: dave@cs.arizona.edu (Dave Schaumann)
Newsgroups: comp.lang.c
Subject: Re: Politically Correct C (was: Re: Freedom of Speech (was: Mister Ed Nilges)
Date: 30 Aug 92 23:36:05 GMT
Reply-To: dave@cs.arizona.edu (Dave Schaumann)
Distribution: usa
Organization: University of Arizona

In article <19978@plains.NoDak.edu>, hennebry@plains (Michael J. Hennebry) writes:
>In article <1992Aug28.150040.21463@Princeton.EDU> egnilges@phoenix.Princeton.EDU (Ed Nilges) writes:
>>but it is inexcusable to code
>
>>     if (!(farkle))
>
>>since it is obvious even to the tyro that the "scope" of the not
>>operator ! is "farkle" (what else COULD it be??)  
>
>Without the "extra" parentheses it could be "fire" as in the following
>example:
>
>boss.h: /* immutable if peon wants to keep his job */
>
>#define farkle fire || flood

This #define is broken.  Period.  The right place to put parens is around
the macro definition, not everywhere it is expanded.

If you've got a boss that won't let you change broken header files, you
might consider sprucing up your resume, and checking around, because
chances are good s/hes got other obnoxious habits as well.

-- 
Essentia non sunt multiplicanda praeter necessitatum -- William of Ockham
(Fact need not be multiplied beyond necessity)
Newsgroups: comp.lang.c
From: rsmith@pioneer.arc.nasa.gov (Roger Smith RCS)
Subject: Question re:Preprocessor Symbols
Organization: Sterling Software @ NASA - Ames Research Center
Date: Wed, 26 Aug 92 17:58:30 GMT

This is probably a stupid question, but I've spent hours combing
the man pages and the FAQ.

How can I get a list of all of the symbols understood by the
preprocessor. I'm referring to the sort of symbols one would
use in an #ifdef statement to discern operating system or
architecture, i.e., sun, mips, etc.

Thanks in advance for any response. Please e-mail and I will
post a summary if appropriate.
------------------------------------------------------------------
Roger Smith
Sterling Software at
NASA-Ames Research Center
rsmith@proteus.arc.nasa.gov
- 
If change is -- inevitable -- predictable -- beneficial -- 
doesn't logic demand that you be a part of it?
One man cannot summon the future. But one man can change the present!
    -- Kirk and the Alternate Spock, "Mirror, Mirror," stardate unknown
+
From: wirzeniu@klaava.Helsinki.FI (Lars Wirzenius)
Newsgroups: comp.lang.c
Subject: Re: C preprocessor include
Date: 4 Sep 92 18:34:00 GMT
Organization: University of Helsinki

tv@risken.vd.volvo.se (Taisto Varis) writes:
>Is it possible to change the behaviour of the #include "..." 
>in the preprocessing phase of the C compiler.

Depends on your compiler.  The manual should explain it, if it is
possible.

>It does not look for UNIX environmenmt variables.

I'm not certain if I understand this correctly, but do you want a "path"
variable for include directories a la the PATH environment variable for
executables?

>Is there a way to keep a file from getting included more than once.
>Note, that i do not want the file to be opened at all.

header.h:
	#define HEADER_H
	/* all the rest of the stuff */

source.c:
	#ifndef HEADER_H
	#include "header.h"
	#endif

Some compilers have unportable pragmas that will do this without the
ifndef/endif around the #include in a source file.

--
Lars.Wirzenius@helsinki.fi
Newsgroups: comp.lang.c
From: gok@cs.montana.edu (Michael Smith)
Subject: Looking for c libraries
Organization: Dept. of Computer Science, MSU, Bozeman Mt 59717
Distribution: usa
Date: Wed, 2 Sep 1992 02:56:28 GMT

I am looking for a set of c libraries that interfaces with Dbase.  The name that
I was given is somthing like Cbase.  If any one could help please email. 

Thanks
mike

-- 
Montana State Climatology Office     | Mike Smith - Programmer/Analyst
Montana State University             | ussjc@trex.oscs.montana.edu
Bozeman, Mt. 59717                   | gok@fubar.cs.montana.edu
(406) 994-5067                       | Opinions expressed are my own, and
Newsgroups: comp.lang.c
From: cflatter@nrao.edu (Chris Flatters)
Subject: Re: C vs. FORTRAN
Reply-To: cflatter@nrao.edu
Organization: NRAO
Date: Fri, 4 Sep 1992 16:06:18 GMT

In article 6039@menudo.uh.edu, svec5@menudo.uh.edu (T.C. Zhao) writes:
>Yet another possibility (although it won't explain the huge difference):
>Fortran compiler knows the sin and cos functions and hence there is
>a possibility to do inlining while C compiler is not aware of these
>functions and there is no possibility of doing so without violeting
>the standard.

An ANSI C compiler is allowed to inline any standard library functions,
including sin and cos.

	Chris Flatters
	cflatter@nrao.edu