HDTenEightyP/NetNews huggingface dataset:
From: wieck@jwminhh.hanse.de (Jan Wieck)
Subject: Re: Piping and return code again! Please help !!!
Organization: Private Site under Mach386
X-Newsreader: Tin 1.1 PL4
Date: Thu, 7 Jan 1993 00:16:26 GMT

tongb@woods.ulowell.edu writes:
:
: Please help!!!!!
:
: How do we make piping works in C for a DOS system?
:
: Dos offers:
:
: c:> program1 | program2
:
: to pass the output of the program1 as the input of the program2.  Now if we
: have a C var declared as
:
: char mystring[] = "this is a string";
:
: and we have a DOS program program2.exe which reads a string from stdin and
: return a exit code (used in batch file as errorlevel).
:
: How do I pass mystring to the program2.exe and get a return code in C?
:
: I can't sleep if this problem is not solved.  Please help !!!!


        Poor boy, you got the wrong job! But don't worry, be hap-
        py - here's the solution.

        Just use something like this (I know, it's a hack):

            ...
            int retval;
            char cmd[128];      /* DOS-commandline cannot exceed 127
                                 * char's as a heir of CP/M - so it's
                                 * O.K. to be hardcoded until 2038 :-)
                                 */
            ...
            sprintf(cmd, "echo \"%s\" | program2", mystring);
            retval = system(cmd);
            ...

        Remember, that this isn't portable.  The  syntax  of  the
        commandline  may  be  wrong for the OS or no echo-command
        may exist. Also possible is, that system(3)  doesn't  re-
        turn any exit-status of the executed command.


Until later, Jan

-- 
# Any language keeps its own misunderstandings; #
# why shouldn't programming languages do?       #
#                                               #
#            wieck@jwminhh.hanse.de (Jan Wieck) #
Newsgroups: comp.lang.c
From: tmc@spartan.ac.BrockU.CA (Tim Ciceran)
Subject: Re: Pattern Matching for Spelling Correction 
Organization: Brock University, St. Catharines Ontario
Date: Sun, 10 Jan 1993 01:00:49 GMT

In article <726524557snz@panache.demon.co.uk> raph@panache.demon.co.uk writes:

>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.

Not all of us can readily access these journals, and asking for the
insights of others is a little more practical than going for a 75 minute
drive.

From: dr@hpcuhe.cup.hp.com (Dick Rupp)
Date: Thu, 7 Jan 1993 00:32:16 GMT
Subject: Opinions Wanted on Optimizer Options
Organization: Hewlett Packard, Cupertino
From: volpe@bart.NoSubdomain.NoDomain (Christopher R Volpe)
Newsgroups: comp.lang.c
Subject: Re: Is that ansi ?
Date: 8 Jan 93 21:47:04 GMT
Reply-To: volpe@ausable.crd.ge.com
Organization: GE Corporate Research & Development

In article <1993Jan8.165451.7873@wraxall.inmos.co.uk>, nathan@inmos.co.uk (Nathan Sidwell) writes:
|> 
|> Now I'm not 100% sure that you can cast any function pointer to void (*)(void), and
|> back again without loss, but I can find nothing in ANSI which states this, and
|> can think of no reason why that might not be so.

This is explicitly sanctioned in "3.3.4 Cast Operators".

-- 
==================
Chris Volpe
G.E. Corporate R&D
volpecr@crd.ge.com
From: chuckb@stein.u.washington.edu (Charles Bass)
Newsgroups: comp.lang.c
Subject: should main be prototyped?
Date: 12 Jan 93 23:09:43 GMT
Article-I.D.: shelley.1ivj3nINNa5v
Organization: University of Washington
NNTP-Posting-Host: stein.u.washington.edu

Someone asked me if main should be prototyped today and I
couldn't answer because of the following conflict in my
prototyping habits:

1) All functions should be prototyped.
2) I've never seen a prototype for main. (not found grepping the
   .h files or in my 2 years of programming)

For code that should be ANSI/portable should a prototype be
used for main?

chuckb
Newsgroups: comp.lang.c
From: md@sco.COM (Michael Davidson)
Subject: Re: use of REALLOC under UNIX system
Organization: The Santa Cruz Operation, Inc.
Date: Mon, 11 Jan 1993 22:16:07 GMT


scst81@csc.liv.ac.uk (Mr. I. Rowland) writes:


>  I have a problem with some C code

   [ .... ]
>  However when I run this, at the first occurence of the REALLOC function
>  clast_str = realloc(clast_str,bytes)     bytes = length of name + 1
>                                           `+1' to account for `\0'
>  the error `Bus error(coredump)' occurs.

The problem is that clast_str is uninitialised on your first call
to realloc() - the only valid thing that you can pass to realloc()
as it's first argument is the pointer returned from a successful
call to malloc(), calloc() or realloc(). In other words, you can't
RE-allocate something that you have never allocated in the first place!

You were lucky that the call to strlen(clast_str) didn't dump core
as well.
Newsgroups: comp.lang.c
From: ertle@kira.uvm.edu The Sneaky Devil
Subject: Re: Debugging with 2 terminals. HELP!!!!!
Organization: University of Vermont -- Division of EMBA Computer Facility
Distribution: usa
Date: Sun, 10 Jan 1993 13:37:08 GMT

In <1993Jan10.060451.19694@spillman.uucp> tye@spillman.uucp (E. Tye McQueen) writes:

>herring@netcom.com (John Herring) writes:
>)Does anyone know of a debugger that will allow me to run the program on
>)one terminal and debug using the debugger in another terminal?

dbx and gdb ( and possibly others ) allow you to attach a process that
is already running using the "attach" command, I believe.  So, start
the process on one terminal ( maybe put in code to get input just
before the part your interested in so it will stop there first ), then
start the debugger on the other terminal and type "attach pid" where
"pid" is the process id of the prorogram you want to debug.  You can
interrupt the execution of the process with ctrl-c.  Good luck!

--
James A. Ertle                       |... but she's being so
ertle@{hal|sal|kira|griffin}.uvm.edu |DIFFICULT!!!
UVM's EMBA Computer Facility         |		- The Beast
Burlington, Vt. USA                  |	
Newsgroups: comp.lang.c
From: brown@NCoast.ORG (Stan Brown)
Subject: Re: How to read without echo.
Organization: Oak Road Systems, Cleveland Ohio USA
Date: Thu, 7 Jan 1993 14:58:08 GMT

In article <1i9pi5INN972@taloa.unice.fr> vyskocil@taloa.unice.fr (Vyskocyl) writes:
>I only want to read a word on the keyboard without any print on the screen. 

I have just read all five (on my system) follow-ups to this query.  

Without prejudice to _what_ they said, it was unnecessary for them to
say it, because this often-asked question is answered in the FAQ list.

Please, folks, read the FAQ list before you post a query, or before you
post an answer to one.  (I said this in email to the original poster and
the first folow-up poster, but it appears a more general appeal may be
warranted.)

If you can't find the FAQ list, you are welcome to email me for canned
instructions on retrieving FAQ lists from this group and others.
-- 
Stan Brown, Oak Road Systems                      brown@Ncoast.ORG
Cleveland, Ohio, USA
From: hartman@ulogic.UUCP (Richard M. Hartman)
Newsgroups: comp.lang.c
Subject: Re: Any hope for me..?
Date: 7 Jan 93 23:22:04 GMT
Organization: negligable

In article <726355710snz@panache.demon.co.uk> raph@panache.demon.co.uk writes:
>When I employ programmers I prefer those with a degree in English or History
>or Physics, or anything except CS. They tend to have more rounded knowledge
>and don't think that they know it all.
>
>My experience of CS graduates is that, by and large, they have read nothing
>and know nothing that was not in their degree course.
>-- 
>Raphael Mankin			Nil taurus excretum

Strangely enough, this is not an unheard of theory.  Computer science
courses teach "how to do", whereas liberal arts courses teach "hot to
think" .... or so the theory goes.

My own background is in linguistics, before I switched over to cis.
I think that the training given in language analysis there was one
of the most useful things I had in college for my current occupation!

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Between the silence of the mountains	|
and the crashing of the sea 		|	-Richard Hartman	
there lies a land I once lived in	|	hartman@uLogic.COM
and she's waiting there for me.		|
Newsgroups: comp.lang.c
From: rfries@sceng.ub.com (Robert Fries)
Subject: Re: should main be prototyped?
Organization: Ungermann Bass
Date: Tue, 12 Jan 1993 23:31:10 GMT

In article <1ivj3nINNa5v@shelley.u.washington.edu> chuckb@stein.u.washington.edu (Charles Bass) writes:

>Someone asked me if main should be prototyped today and I
>couldn't answer because of the following conflict in my
>prototyping habits:

>1) All functions should be prototyped.
>2) I've never seen a prototype for main. (not found grepping the
>   .h files or in my 2 years of programming)

>For code that should be ANSI/portable should a prototype be
>used for main?

>chuckb

I don't think it matters, unless your program calls main() itself.

Robert

//////////////////////////////////////////////////////////////////////////
Robert Fries
Ungermann-Bass Inc.

DISCLAIMER:
    Opinions contained herein are my own, and are not necessarily those
    of Ungermann-Bass.
//////////////////////////////////////////////////////////////////////////
From: ayoung@vax.oxford.ac.uk
Newsgroups: comp.lang.c
Subject: peeling algorithm ?
Date: 12 Jan 93 18:57:05 GMT
Organization: Oxford University VAX 6620


 I'm looking for an algorithm to efficiently map data structures which store
family trees (for a medical project) and have been told that something called
the "peeling algorithm" is often used for this.  Does anybody have a reference
to this - or better yet can give me a short explanation ?

-------------------------------------------------------------------------------
     ___
    /   \   /                 |    /      Alan Young @ uk.ac.ox.vax
   /____/  /  ___    __       |___/
  /    /  /  /   |  /  |         /           "The bigger they are,
 /     \_/\__\__/|_/  /_________/               the harder they fall on you."
Newsgroups: comp.lang.c
From: raph@panache.demon.co.uk (Raphael mankin)
Subject: Re: Problem with Turbo-C: calculating with pointers 
Distribution: world
Organization: Solvfield Ltd.
Reply-To: raph@panache.demon.co.uk
X-Mailer: Simple NEWS 1.90 (ka9q DIS 1.19)
Date: Fri, 8 Jan 1993 20:26:30 +0000

In article <1993Jan7.112219.578@reks.uia.ac.be> derijkp@reks.uia.ac.be writes:

>I am porting a program (working on different platforms such as VAX and DEC) to
>the PC. I am using Turbo C++ v.3.0. I compile using the huge memory model.
>I seem to have tracked down the problem (well, one of the problems.) I don't
>know what to do about it though. Here's a little program to illustrate the
>problem:
>
>#include <alloc.h>
>
>main()
>{
>char *pointer,*begin,*end;
>long size;
>
>size=71800;
      ^^^^^
make this 71800L and it will work. This compiler like many others treats integer
cosntants as 16-bit ints. 61800-65536 == 6264.
QED.

>pointer=(char *)farmalloc(size*sizeof(char));
>begin=pointer;
>end=pointer+size;
>printf("%p %p %ld",begin, end, end - begin);
>}
>
>I would expect end - begin to return 71800. However it seems to return 6264.
>This is exactly 64K less.
>If this happens for all pointer calculations, I'm in big trouble.
>Any ideas to solve this.

Better still, don't do pointer arithmetic. It is a sure route to trouble.

-- 
--------------
Raphael Mankin			Nil taurus excretum
Newsgroups: comp.lang.c
From: drevik@utkvx3.utk.edu (Drevik, Steve)
Subject: Borland Support: JD Powers AD is B.S.
News-Software: VAX/VMS VNEWS 1.41    
Organization: University of Tennessee Computing Center
Date: Wed, 6 Jan 1993 21:17:00 GMT

FYI directed towards future developers who are thinking
about what C or C++ compliler to use....

I could not believe my eyes when I read the AD saying that
JD Powers rated Borland as "#1 in service."  Maybe in shipping
and billing, but their tech support leaves a LOT to be desired.

About a year ago, I complained about a linker crash.  I had
all kinds of info from the error message (exception error
codes, addresses, etc).  I was informed that NO ONE there was
able to use that information.

Later on, I found out what the problem was, and worked my
way around it (the linker can no deal with a library > 1 MB).
I TOLD BORLAND exactly what the problem was, in hopes they
could provide better service to those with the same problem
who called later, and maybe come up with a solution to the
limitation.  OR AT LEAST IMPROVE THE ERROR MESSAGE!!


Just recently, another employee had the same problem and
called Borland.  Did they learn from the data I had given
them?  Of course not.  My employee was lost until I 
returned to work.

In short, when you have a problem, expect Borland support
to say the following:

  1.  "Remove all your TSR's and everything in your
       config.sys and autoexec.bat except for FILES
       and BUFFERS.  Reboot and try again."

      (ie, it's not our problem, it's something you've done)

 2.  "Well you might TRY downloading fix fix blah-blah-blah
      from our BBS"

 3.   "Neither of those work?  I don't know."

Save yourself the long distance charges.  Better yet, save
yourself money and time and buy something else!!!


Newsgroups: comp.lang.c
From: shankha@clsi.COM (Shankha Mitra)
Subject: const and pointers in ANSI C
Originator: shankha@clsi
Organization: CAD Language Systems, Inc.
Date: Tue, 12 Jan 93 16:49:49 GMT



Consider the following C code:

	int * const constant_pointer;
	const int *pointer_to_constant_data;

So the location of the type qualifier const in the declaration determines whether
the pointer itself or the contents is the constant entity.

Now suppose you use this instead:

	typedef int *int_pointer;
	const int_pointer x;
	int_pointer const y;

My compiler (xlc on the RS/6000) which is fully ANSI compatible (or so they claim)
considers the declarations of x and y to be equivalent; it considers x and y to
be constant pointers.  That is I can say,

	*x = *y = 1;

but not

	x = y = &i;

Interesting, huh?

The "C Reference Manual" (Harbison and Steele) corroborates the above behavior.
So does gcc -ansi.

My questions: 
	1) Why this disparity in behavior between using explicit types (the first
	   code fragment) and typedefed types (second code fragment)?
	2) Is it possible to make a declaration of a pointer to constant data
	   using the typdefed int_pointer?  If so, how?

Thanks in advance.

Shankha
-- 
-------------------------------------------------------------------------------
Shankha S. Mitra                                               shankha@clsi.com
CAD Language Systems, Inc.				 	 (410) 992-1716
-------------------------------------------------------------------------------
Newsgroups: comp.lang.c
From: hmchen@fcom.ee.ntu.edu.tw (Hung-ming Chen)
Subject: rs485 specification need
Organization: NTUTaiwan
Date: Thu, 7 Jan 1993 02:00:26 GMT

Dear netter:
  Does anyone know where to get informations about RS485
(especially some detail about it's protocol)?  Your help would
be highly appreciated. My Email address is: 
                               fumin@en.tit.edu.tw

- fumin
Newsgroups: comp.lang.c
From: jutta@opal.cs.tu-berlin.de (Jutta Degener)
Subject: Re: Problem with string processing.
Organization: Techn. University of Berlin, Germany
Date: Mon, 11 Jan 1993 19:25:40 GMT

eager@eagercon.com (Michael J. Eager) writes:
> rogers@calamari.hi.com (Andrew Rogers) writes:
>> In article <...> alane@wozzle.linet.org (J. Alan Eldridge) writes:
>>>>         char tmp[2] = {0};
>> tmp[1] most certainly does have a 0 in it; if the initialization list for
>> an array contains fewer elements than the array itself, then the remaining
>> array elements are initialized to 0. [..]
>
> Well, the relevent section is 3.5.7, which says, in part "If an object that 
> has automatic storage duration is not initialized explicitly, its value is
> indeterminate."  Lacking a 'static' declaration and being within a function
> means that tmp has automatic storage.  Only the first element is initialized
> to zero, tmp[1] is undefined.

No, the relevant section is 3.5.7, which says, in part "If there are fewer
initializers in a brace-enclosed list than there are members of an aggregate,
the remainder of the aggregate shall be initialized implicitly the same as
objects that have static storage duration."

Jutta (jutta@cs.tu-berlin.de)
Newsgroups: comp.lang.c
From: vpham@cs.ulowell.edu (vinh)
Subject: Re: C code Layout
Organization: University of Massachusetts at Lowell Computer Science
Date: Fri, 8 Jan 1993 01:40:56 GMT

In article <1993Jan8.003437.17036@organpipe.uug.arizona.edu> dave@cs.arizona.edu (Dave Schaumann) writes:
>In article <76210@apple.apple.COM>, apn@Apple (Alex Novickis) writes:
>>In article <MITCH.92Dec24105749@pollux.clsi> mitch@clsi.COM (Mitchell N. Perilstein) writes:
>>>> P.S I've got some macros for vi that solve mazes. Try that in poo. Sorry,
>>>> EMACS.
>>>I've got some lisp for emacs which emulates vi.  Does vi emulate emacs?
>>That's exactly it!!!!!! Emacs users still have a need for vi ( I guess to
>>do real editing) and vi users have no need for emacs ( for whatever it
>>is used for )
>Oh, brother.  Editor flame wars again...
>Personally, I use gnuemacs.  Why?
>  -automatic paren matching ( and ), [ and ], { and }
i think you guys are comparing apples an oranges here:
emacs is an OS, vi is an editor, got that?
Newsgroups: comp.lang.c
From: gcouger@olesun.okstate.edu (Gordon Couger)
Subject: Re: Problem with string processing.
Organization: Oklahoma State University, Stillwater
Date: Mon, 4 Jan 1993 02:53:51 GMT

In article <1993Jan3.194154.1740@data-io.com> dietz@parody.Data-IO.COM (Kent Dietz) writes:
>In article <1993Jan2.233446.20833@iitmax.iit.edu>, matujos@elof.iit.edu (Joe Matusiewicz) writes:
>|> 
>|>    I am having a little problem with string processing.  I have been
>|> programming in C for 6 months, and I just can't figure out the following
>|> problem:
>|> 
>|>    I need a function to append a character to the end of a string.

#include <strings.h>

char *add_char(char *s, char c)
   {
   char *sp = s;
   while(*sp++)
      ;  /* finds end of string and leave pointer for adding char */
   *sp-1 = c; 
   *sp = NULL;
   return s;
   }
This sould do the job and be pretty quick at the same time.
Of course there must be enough room in the string passed to the function
for the added char. 
Good luck
Gordon

Gordon Couger
AB5Dg   Agriculture Engineering Oklahoma State University
gcouger@olesun.agen.okstate.edu 405-744-6514 day 744-2794 evenings   
Newsgroups: comp.lang.c,comp.lang.c++,comp.lang.misc
From: rs@cmie.ernet.in (Rajappa Iyer)
Subject: Re: How to turn PC speaker off?
Organization: Centre for Monitoring Indian Economy, Bombay
X-Newsreader: Tin 1.1 PL4
Date: Thu, 7 Jan 1993 05:58:09 GMT

wieck@jwminhh.hanse.de (Jan Wieck) writes:
: cschang@hamlet.umd.edu (C. S. Chang) writes:
: : 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.
: 
: Oh, you wanted a solution for PC-DOS? Well, also possible, cut the
: wire (this is no joke - it's the only way under PC-DOS).

Well, yes, this is the only way to do it for programs which control
the sound chip directly and / or write to the speaker port. But if you
are interested in cutting out plain vanilla beeps from plain vanilla
apps (which are likely to be using a dos / bios call to write ASCII 7 for
beep) then you *can* intercept the bios video interrupt and disable the
beep.

e-mail me if you are interested in the source to do this.

-- 
Rajappa Iyer			rs@cmie.ernet.in (Preferred)
				riyer@shakti.ncst.ernet.in
From: jfw@ksr.com (John F. Woods)
Newsgroups: comp.lang.c
Subject: Re: This will work under unix now
Date: 5 Jan 93 12:49:05 EST

jp@tygra.Michigan.COM (John Palmer) writes:
>Dug this out of the code that I saved from this group (and others).
>It wouldn't work under XENIX/UNIX as you cannot give both variable
>names and their types in the function definition (inside the '()'s)
>---
>#include <stdio.h>
>#include <stdlib.h>
>char * strwrap(char *, int, int);

>char * strwrap(s, w, o)
>	char *s;
>	int w,o;
>{

If your compiler does not accept a definition like

	char * strwrap(char *s, int w, int o)
 	{ ...

then it isn't an ANSI C compiler.  If it claims to be, demand your money back.
(That style is also acceptable for the prototype, as well.)

If it doesn't claim to be an ANSI C compiler, consider investing in one.
At any rate, this isn't a "unix" issue, since fully-compliant ANSI C compilers
for UNIX are a dime a dozen.
From: jos@and.nl (Jos Horsmeier)
Newsgroups: comp.lang.c
Subject: Re: Piping and return code again! Please help !!!
Date: 5 Jan 93 09:11:37 GMT
Organization: AND Software BV Rotterdam

In article <1993Jan4.212844.1@woods.ulowell.edu> tongb@woods.ulowell.edu writes:
|
|Please help!!!!!
|
|How do we make piping works in C for a DOS system?
|
|Dos offers:
|
|c:> program1 | program2
|
|to pass the output of the program1 as the input of the program2.  Now if we
|have a C var declared as char mystring[] = "this is a string";
|
|and we have a DOS program program2.exe which reads a string from stdin and
|return a exit code (used in batch file as errorlevel).
|How do I pass mystring to the program2.exe and get a return code in C?
|I can't sleep if this problem is not solved.  Please help !!!!

I ran into this problem several years ago when I was forced to use MSDOS.
Sorry to disappoint you, but this brain dead OS-wannabe does not know 
anything about such things as pipes. The `|`' symbol on the command line
is processed by the shell (COMMAND.COM) and all it does is an freopen of
the stdout for program1 into a temporary file. When program1 is finished,
the second program is fired up with its stdin freopened using the temporary
file. After program2 has finished, the file is removed. The shell simply
fakes a pipe operation since MSDOS doesn't support this. 

So all you can do is: write your output to a file (maybe using freopen
on stdout) and exec the second program after doing an freopen on stdin,
using the same file. It's a kludge, I know ...

kind regards,

Jos aka jos@and.nl
From: mike@pacsoft.com (Mike Stefanik)
Newsgroups: comp.lang.c
Subject: Re: Moving from Pascal to C, Help please!!!!!!
Date: 10 Jan 93 00:12:33 GMT
Organization: Pacific Software Group, Riverside, CA

In article <726510754snz@panache.demon.co.uk> raph@panache.demon.co.uk writes:
>IMHO the only thing one can say about pointer arithmetic is DON'T.

IMHO, if you don't feel comfortable using pointer arithmetic, you don't
feel comfortable with the C language.

If given the choice between a stranglehold in the name of safety or enough
rope to hang myself, I prefer the latter. :-)

-- 
Mike Stefanik  mike@pacsoft.com  ...!uunet!pacsoft!mike  (909) 681-2623
Pacific Software Group, Riverside, CA