HDTenEightyP/NetNews huggingface dataset:
From: misar@rbg.informatik.th-darmstadt.de (walter misar)
Subject: Re: how to I continue a long string on the next line of code?
Date: Fri, 11 Dec 1992 17:54:41 GMT
Organization: TU Darmstadt

In article <EJH.92Dec10105245@khonshu.colorado.edu>, ejh@khonshu.colorado.edu (Edward J. Hartnett) writes:
> 
> I'm writing a function with a bunch of lines like this:
> 
>   fprintf(fp,"Lat: %d Long: %d sza: %d elev: %d skin temp: %d model pressure: %d",
> 	  s.lat,s.lon,s.sza,s.elev,s.modpres);
>   fprintf(fp,"icc: %d retrieval method: %d sdll: %d sdml: %d n: %d box: %d flag: %d",
> 	  s.icc,s.retmeth,s.;
> 
> This is fine on my big old Sun screen, but when I'm working on a text
> terminal, or from home, these lines will wrap in an annoying way. I
> want to continue them on the next line, breaking it in the middle of
> the string. Like this:
> 
>   fprintf(fp,"icc: %d retrieval method: %d sdll: %d sdml: %d n: 
> 	%d box: %d flag: %d",s.icc,s.retmeth,s.;
> 
> But emacs C-mode couldn't handle the indentation properly, so I
> presume that it wouldn't work. What is a good way to do this?
One way is to put an \ at the end of the first line and begin the second at
tab 0 like in:
printf("Not a so long \
string\n");

If you work with an ANSI compiler you could just make two strings, which will
be concatenated by the compiler like in:
printf("This looks a little"
       " bit more readable\n");


-- 
Walter Misar
misar@rbhp56.rbg.informatik.th-darmstadt.de
Xref: sparky comp.lang.c:18432 comp.lang.c++:18028
From: a036450@rd821.UUCP (Bob Goldrich)
Newsgroups: comp.lang.c,comp.lang.c++
Subject: Text Searching and Hypertext
Date: 15 Dec 92 14:07:14 GMT
Followup-To: comp.lang.c
Organization: The Gleason Works, Rochester New York
X-Newsreader: Tin 1.1 PL4

I'm looking for source code for a text search engine.  It should suppor
regular expressions with wild cards.  I guess source to a grep-like
utility would be fine, but if there is anything else out there I would
appreciate a pointer to it.

Also, can anyone point me to source which does searches like "find all
the occurances of <some word> which is within <x> words of <another
word>?  Is this what is known as a fuzzy search?  If not, what *is* a
fuzzy search?

Finally, I would like to build hypertext links based on a list of key
words which I will compile.  Again, are there utilities/source code
available, or references which discuss this?  

Please reply by E-mail.  Many thanks.

                     Bob Goldrich   a036450@rd821.gleason.com

Xref: sparky comp.lang.c:18701 comp.lang.c++:18252 comp.lang.misc:4066
From: cschang@hamlet.umd.edu (C. S. Chang)
Newsgroups: comp.lang.c,comp.lang.c++,comp.lang.misc
Subject: How to turn PC speaker off?
Keywords: PC, c, c++, speaker
Date: 20 Dec 92 09:08:09 GMT
Organization: University of Maryland, College Park

Is there any way to turn the PC speaker off so that there will be no
beeps if a certain function call failed.  I do not have access to this
particular function call which beeps at failure.  So I am looking for
a way to prevent the PC from generating some beeping noise.

Thanks in advance.


Truly Yours, C.S.Chang 


===================================================================
Programmer/Designer		Vice President	
AT&T Teaching Theater		Asian Engineering Association
Computer Science Center		University of Maryland
Room: ENGR 3140			Mailbox: ENGR 1131

Chairman			President
EE/SAC Computer Committee	Literature and Narrative Critiquing Society
University of Maryland		University of Maryland
Mailbox: AVW 2466		PO Box 405, College Park 20741

Phone:  (O) 301-403-1064; 301-680-1968; 
E-mail: cschang@umd5.umd.edu; cschang@wam.umd.edu; cschang@eng.umd.edu



Newsgroups: comp.lang.c
From: brown@NCoast.ORG (Stan Brown)
Subject: Re: Finding the number of days between two dates
Organization: Oak Road Systems, Cleveland Ohio USA
Date: Sun, 13 Dec 1992 23:55:38 GMT

In article <1992Dec10.181940.10135@linus.mitre.org> jrv@truth.mitre.org (Van Zandt) writes:
>In article <1992Dec9.011317.26944@klaava.Helsinki.FI> wirzeniu@klaava.Helsinki.FI (Lars Wirzenius) writes:
>>pjh@cs.tut.fi (Haavisto Petri) writes:
>>>1. When using mktime(), is it necessary to set all fields of the
>>>tm-structure to correct values? 
>>
>>No.  tm_wday and tm_yday (and tm_isdst?) are computed by mktime based
>>on the other fields.  In fact, the required fields do not have to be
>>in their required fields either, mktime normalises them.  
>
>The Borland docs claim their mktime() normalizes those values, but
>it doesn't.  (I'm posting a separate msg on that.)  My "Osborne McGraw-Hill
>C the Complete Reference" doesn't mention the normalization.  Is it required
>by the standard?

Yes.  Sec 4.12.2.3 (ISO sec 7.12.2.3, I believe) so states in
"Description".

It seems to me that people who buy books about the standard instead of
buying the standard are engaging in false economy.  If you want to know
what the standard says, the best way to find out is to look in the
standard.  Again and again, people have posted excerpts from books that
_claim_ to explain the standard, but have errors or omissions.

-- 
Stan Brown, Oak Road Systems                      brown@Ncoast.ORG
Cleveland, Ohio, USA

Eternal life: a threat, not a promise.
Newsgroups: comp.lang.c
From: der@hpuerca.atl.hp.com (Dave Ritchie)
Subject: Re: Modem to Modem Linkage Procedures
Date: Thu, 17 Dec 1992 09:38:22 GMT
Organization: Hewlett-Packard NARC Atlanta

Troy,
    have you looked at your local library or technical bookstore? I can
think of at least 3 books that deal with serial communications, and at 
least one of these is fairly widely available and discusses specific 
implementation details for PC based serial communications. Since you
didn't mention have used these resources prior to sending a request
to the network, I will point you in that direction first since I suspect
you are not going to receive from the net the amount of info you need
in order to understand the problem that you are trying to solve.

    I am not telling you the names of the books, BTW, because 1) I
am not a walking Books In Print, and 2) because you are a student
and need to learn the procedures for doing research on your own.

-- Dave Ritchie
der@hpuerca.atl.hp.com
From: jwilson@kuhub.cc.ukans.edu
Newsgroups: comp.lang.c
Subject: Executing Code during SYSTEM() calls?
Date: 14 Dec 92 17:33:29 CST
Organization: University of Kansas Academic Computing Services

I am working on writing a front end program which will transfer
files from a VAX/VMS system to a SUN/UNIX system via FTP.  I have
the file handling and idiot-proofing done but I have not discovered
a method of using the FTP mechanism while the c code is still executing.
I have been using the ANSI function system().  However, once the intrepreter
has control of the system, I can no longer issue commands to login to the
sun system with USER and PASSWD.  It is necessary to hide the login from
the user for reasons of simplicity and security.  Does anyone know of a
mechanism which 'C' or FTP provides to accomplish this task?  Any help
would be greatly appreciated.

-Jason
jwilson@kuhub.cc.ukans.edu
Newsgroups: comp.lang.c
From: misar@rbg.informatik.th-darmstadt.de (walter misar)
Subject: Re: Signal() function & CTRL-C checking...
Date: Thu, 17 Dec 1992 08:41:35 GMT
Organization: TH Darmstadt

In article <1992Dec16.053939.1014@monu6.cc.monash.edu.au>, alien@yoyo.cc.monash.edu.au (Diego Barros) writes:
> I have a quesiton concerning the signal function and how it is used. I'm
> trying to set up a routine which is called when anyone of 4 interrupts
> occur. When one of them does occur then a single function is called
> which will clean up and exit the program. The main reason is to detect
> when the user presses CTRL-C to break program execution.
> 
> Could someone please explain what exactly the signal prototype in the
> signal.h file is declaring (in english?!?) :) As knowing what the
> function is declared as would of course help my understanding as to how
> to use the function call.  
> 
> <signal.h>	extern void (*signal(int __sig, (*__func)(int)))(int);
> 
> And how should I declare the function which is called when one of the 4
> interrupts occur, what's its prototype? And how is signal called
> exactly?

Let's see: void (*signal(....))(int)
=> signal is a function returning a pointer to a function which takes an int
as argument and doesn't return any value (void).
Now for the parameters: int __sig nameof the signal (SIGINT for ^C)
(*__func)(int) or void (*__func)(int) on other machines means, that the
second argument is a pointer to the function that should be called upon
occurrence of the signal. SIG_IGN (ignore) and SIG_DFL (default) can be
specified also.
Here's an small example programm:

#include <stdio.h>
#include <stdlib.h>
#include <signal.h>

void ctrlc(int arg)
{ static int i=0;

  i++;
  fprintf(stderr,"CTRL-C hit !\n");
  signal(SIGINT,ctrlc);
  if (i==3) exit(0);	/* exit on 3rd ctrl-c	*/
}

int main(int argc, char *argv[])
{ signal(SIGINT,ctrlc);
  for (;;);	/* loop for a while	*/
  return 0;	/* return, if you can	*/
}

Hope this helps.
-- 
Walter Misar                        It is impossible to enjoy idling thoroughly
misar@rbg.informatik.th-darmstadt.de       unless one has plenty of work to do.
Newsgroups: comp.lang.c
From: jarmo@ksvltd.fi (Jarmo Raiha)
Subject: How to test a programmer
Organization: KSV Instruments ltd. Helsinki,Finland
Date: Tue, 15 Dec 1992 18:07:12 GMT

I believe that testing a C programmer's abilities by asking some
nitpicking details is wrong. Totally wrong!
Learning such tiny details is easy, and propably not worthwhile.

I'm also beginning to think that especially programmers with a knowledge of
compiler techniques will be lousy programmers. They tend to use
too much shortcuts.

Programming languages are there to give you an abstraction of the hardware.
(IMHO)
You just shouldn't need to care about some trivia. Still, of course you
should know your tools.

So, how to test new employees ? I'd put the best candidates
to a tiny team of other programmers. An expensive test ? sure , but think
about the alternative. In a day or so ,you should find out if (s)he is
capable to a work in a group. The most important thing of all.


Well, to be realistic, I don't know if I can pass my own test ?

Ready to receive all  the flames ....

Jarmo Raiha jarmo@ksvltd.fi
KSV Instruments Ltd.
Helsinki , Finland
From: leffel@csd4.csd.uwm.edu (Christopher J Leffel)
Newsgroups: comp.lang.c
Subject: Re: ISAM routines
Date: 16 Dec 1992 14:51:32 GMT
Organization: University of Wisconsin - Milwaukee
Reply-To: leffel@csd4.csd.uwm.edu
NNTP-Posting-Host: 129.89.7.4
Originator: leffel@csd4.csd.uwm.edu

From article <1992Dec16.133939.2157@sae.com>, by scott@sae.com (Scott Mansfield):
> Informix has a product called C-ISAM.  It is relatively cheap ~$500.

If you do not specifically need ISAM, and you could get by with another
system, I would recommend scouring some ftp sites for libraries...  I know I
saw shareware/freeware (I don't know which) libraries for using Novell's
Btrieve indexing system...  I believe it is at garbo.uwsa.fi...

P.S. if it is not there send me some e-mail... I have the address just not
on me right now...
-- 
-------------------------leffel@csd4.csd.uwm.edu--------------------------
"Don't you try to outweird me, I get stranger things than you free with my
breakfast cereal."    -The Restaurant at the End of the Universe-

Newsgroups: comp.lang.c
From: rcheek@access.digex.com (Richard Cheek)
Subject: changing I/O from screen text
Organization: Express Access Online Communications, Greenbelt, MD USA
Date: Fri, 11 Dec 1992 17:54:06 GMT

HELP!!!
	I have been working on a project that does everything in graphics
mode. I use some functions out of Weiskamps "Power Graphics using Turbo C",
and the program uses a number of window-type interaction boxes for input
of strings of characters. The RETURN enters the string via a scan function
and also terminates the window. What is happening is that the program runs
a while normally, then begins to execute the carriage return on the screen,
shifting everything up one line. Also at times characters are put to the
screen when the  string array is beyond its limit. What I want is some
suggestions on how to get the output changed so that RETURNS won't do this.
I can't figure it out.

Richard
Newsgroups: comp.lang.c
From: David.Empson@bbs.actrix.gen.nz
Subject: Re: RFD: splitting comp.lang.c
Organization: Actrix Information Exchange
Date: Sat, 19 Dec 1992 13:04:11 GMT

In article <1992Dec16.151243.12903@cadkey.com> eric@cadkey.com (Eric Holtman) writes:
> 
> Well, it's getting to the point where kill files just 
> aren't working for this group......
> 
> 
> Therefore, I propose the following splits for this newsgroup
> 
>  [etc.]

You forgot the most important one:

   comp.lang.c.for.those.who.dont.know.about.comp.os.msdos.programmer

:-)
-- 
David Empson

Internet: David.Empson@bbs.actrix.gen.nz    EMPSON_D@kosmos.wcc.govt.nz
Snail mail: P.O. Box 27-103, Wellington, New Zealand
Newsgroups: comp.lang.c
From: mouse@thunder.mcrcim.mcgill.edu (der Mouse)
Subject: Re: Need help: array of pointers to member functions C++.
Organization: McGill Research Centre for Intelligent Machines
Date: Fri, 18 Dec 92 02:18:36 GMT

In article <wong.724526569@sfu.ca>, wong@fraser.sfu.ca (Sam S. Wong) writes:

> HELP: I can't assign the address of my integer member functions to a
> pointer in my array of pointers to integer functions. What's wrong?
> -------------------------------------
> class dummy {
>  public:
>  int hello(void);
> };
> [...]

For starters, you posted your question to the wrong group, comp.lang.c
instead of something else, probably comp.lang.c++.

					der Mouse

			    mouse@larry.mcrcim.mcgill.edu
Newsgroups: comp.lang.c
From: wirzeniu@klaava.Helsinki.FI (Lars Wirzenius)
Subject: Re: Peek/Poke in C
Organization: University of Helsinki
Date: Fri, 18 Dec 1992 19:33:20 GMT

mcdonald@aries.scs.uiuc.edu (J. D. McDonald) writes:
>AND FOLKS, PLEASE, don't go blathering about "portability". It makes you
>look silly. If the address of something on you computer is 13556, that's 
>what it is, and you have no choice about using it.

True, if you have to access memory location 13556, then you have to
access memory location 13556.  The question is, do you have to access
memory location 13556?  ;-)

It is my experience that many programmers in the wonderful (or not so
wonderful) realm of DOS answer this question far too quickly with an
"Of course!".  In practice, what they are after is either utilizing
some machine specific peculiarity (such as getting a random number by
reading from the counter updated by the timer interrupt), or
"efficiency".  I put that in quotes, because what they mean by
efficiency usually means just writing directly to the screen,
especially in programs where that portion of the program is not a
bottlneck, like in a program that counts words in files (the program
will spend several minutes in reading files, then the answer has to be
poked directly to the screen memory in order to save a millisecond or
two).

The fact that the services that MS-DOS provides are inadequate, and in
the old days way too slow (the hardware is fast enough now that e.g.
using DOS for writing things to the screen is quite fast enough in
almost all cases), has lead to the DOS Programmer Syndrome.  People
suffering from this disease make the assumption that any program that
does anything useful has to access the hardware directly and bypass
the operating system.  The earliest sign is usually that they want to
write their own library for writing things directly to the screen
memory.

I'm not saying that all cases of accessing the hardware are wrong,
just that it is way too common a practice, and often not even the best
answer.

Also, the same syndrome probably affects programmers using other tools
as well, but it seems to be worst among DOS programmers.

>The answer is "if you can do it at all in C, you cast the address to
>a pointer of the proper sort and access that pointer ...

The cast might not work, but the implementation might still provide a
way to do it (e.g. via a library routine, or an extension to the
language, such as a new operator), so I think that the correct answer
is "please check your friendly manual; if that doesn't work, try using
a cast".

>But remember, you purists out there, this likely **IS** kernal code.

Only as far as any program running under DOS is kernal code.

--
Lars.Wirzenius@helsinki.fi  (finger wirzeniu@klaava.helsinki.fi)
   MS-DOS, you can't live with it, you can live without it.
From: scjones@thor.sdrc.com (Larry Jones)
Newsgroups: comp.lang.c
Subject: Re: Questions about token merging and trigraphs
Date: 16 Dec 92 22:47:40 GMT

In article <1TA04E3@cdis-1.compu.com>, tanner@cdis-1.compu.com (Dr. T. Andrews) writes:
> Trigraphs are an unpleasant invention from the successor  to  the
> horse  committee.   You will recall that the horse committee gave
> us the camel.  Well, X3J11 gave us trigraphs.  I believe that the
> intention  was to prove that standards groups do better when they
> stick with endorsing widely-used practice.

If you have a better solution to not having some of the C source
characters available in your local character set, I'd like to hear it. 
Remember that it must work for preprocessor commands (since '#' is one
of the questionable characters) and in character and string literals as
well as in more ordinary contexts.  X3J11 recognizes that trigraphs are
a terrible solution to the problem, but they're better than any other
solution we could find.

> The change means that certain old programs may have strings, most
> likely error messages, compiled into something unexpected.

The specification for trigraphs was carefully crafted to avoid as much
breakage as possible.  The most likely problem is a string containing
the punctuation "??!" which will be interpreted as "|", but this is a
non-standard punctuation ("?!?" and "!?!" are much more common) -- lots
of people grep'ed lots of code and I think found exactly one occurrance.
----
Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH  45150-2789  513-576-2070
larry.jones@sdrc.com  or  ...uunet!sdrc!larry.jones
I think your train of thought is a runaway. -- Calvin's Mom
From: robert@isgtec.com (Robert Osborne)
Newsgroups: comp.lang.c
Subject: Re: Question to test general C knowledge
Date: 14 Dec 92 15:16:52 GMT
X-Newsreader: TIN [version 1.1 PL8]

John F. Woods (jfw@ksr.com) wrote:
: >They do not need to be C gods but a strong 
: >knowledge will be required. [...]
: >if you could ask someone one question to test if they
: >generally understand C what would it be. Thanks for your responses.

: "After
: 	int i = 2;
: 	i = ++i;
:  what does i equal?"

The corrent answer is:
    'The likelyhood that I actually want to work for a company that
     asks such stupid questions of a co-op student.'

I don't think this question meets the above criteria.
There are several types of co-op students who would know the answer
to this question:

    1. loyal readers of this group  :-)
    2. geeks who have nothing better to do with their free time at
       university than read the ANSI documents
    3. people who actually write code like this and been burnt by it
    
Do you want to hire somebody from one of these groups?

: If they answer, do not hire them.

Well if it was somebody claiming to be able to talk C with Dennis...
He is after all,  just looking for a Co-op with a strong C knowledge.

Rob.
--
Robert A. Osborne   ...!uunet.ca!isgtec!robert or robert@isgtec.com
From: dsbb@ns1.cc.lehigh.edu (D. SPENCER BEECHER)
Newsgroups: comp.lang.c
Subject: Re: Question to test general C knowledge
Date: 16 Dec 92 19:26:52 GMT
Organization: Lehigh University

D. SPENCER BEECHER) writes:
>|> How about:
>|> What is the difference between:
>|> varname%3
>|> and
>|> varname&0x02
>|>
>|> and why might one be more advantageous to use?
>
>Well, one of them extracts the remainder after division of `varname'
>by three and the other extracts the second from the bottom bit (which
>is considerably different from remainder modulo three).
...etc
>J. Giles

and I thought my question was harder than all that.  I only
got one respondant indicating they are equivalent.

the %3 (I believe) does not have a bit-manipulated closed form

x&0x02 may be represented with modulo as:

  x%=4,x>1?x:0;

though this changes the value of x, where x&0x02 makes no assignment.
-- 
                   _ _     _ _     _ _
  -Spence         [O.O]   )x.x(   )O.O(
                    O       O      -*-
Newsgroups: comp.lang.c,gnu.gcc.help
From: tom@flood.com (Tom Chatt)
Subject: Re: How precise is preprocessor math? (I'm using gcc)
Organization: The Flood Group, Inc.  Torrance, Ca.
Date: Fri, 18 Dec 92 10:49:56 GMT

volpe@ausable.crd.ge.com writes:
| [someone else's confusion about cpp deleted] 
| 
| This simply expands to:
|      printf("Q1=%g q=%q\n", 2.*6371.0/GRIDSPACE_KM*(1.+sin(70.)), q);
| 
| And then the compiler evaluates it, or more likely, just the
| constant expression part of it. (It probably isn't likely that it
| evaluates sin(70) at compile time, but it's allowed to.)

The compiler is allowed to evaluate routine calls at compile time???
I think not! Given that an arbitrary routine may be called repeatedly
with a constant argument without any guarantee that the return value
will be the same, such an evaluation would be mighty presumptuous
on the part of the compiler. Consider, for instance, the standard
Unix call "time(0)" which returns the current system clock value.
Obviously '0' is a constant expression, so does that imply that an
optimizing compiler is "allowed" to evaluate "time(0)" at compile
time?

And this, of course, is aside from the issue that at compile time,
which is prior to linking, the compiler is likely to have no clue
where to *find* an arbitrary routine.

If Chris Volpe was suggesting the more limited proposition that
certain standard calls, such as sin(), are "known" to the compiler,
that's plausible, but still seems dubious. "sin" is not a resrved
word in C, and nothing would prevent me from writing my own "sin()"
routine which did something completely different. Even if all of
the standards committees agreed that no one shall write routines
called "sin" which do anything other than perform the math sine
function, there would still be different implementations, and a
compiler would be presumptuous to pick one for me. I concede that
there is a somewhat standard "libm.a" which comes with various
flavors of Unix, but at least on my systems (SunOS) "sin" takes its
argument in radians, while the "sin" routine being used by the
example above apparently expects degrees.

In any event, a C compiler would be unjustifiably presumptuous to
evaluate a "sin" call at compile time. If you know of any compilers
that actually do this, please let me know so I can avoid them.
a call to a "sin" routine.

As to the original question, if you are really concerned about
eliminating unneccesary calculations during runtime, you are
best served by calculating the value of the expression yourself
and putting the result in a #define, and the derivation in a
comment:

    #define Q1  9.0764283749327654
	    /* Q1 = 2.*6371.0/GRIDSPACE_KM*(1.+sin(70.) */

-- 
Tom Chatt                        \   Don't take offense, take action.
Internet: tom@flood.com           \    Speak up. When we remain silent,
UUCP: ...!uunet!flood!tom        / \     we oppress ourselves.
Newsgroups: comp.lang.c