Re: shift() in C std lib

2002-12-11 Thread Steven W. Orr
On Wed, 11 Dec 2002, Price, Erik wrote:

=>I'm wondering if there's a shift() function (similar to the one in Perl/
=>PHP/etc) in the C standard library?  (I have access to the C std lib
=>that comes with Gentoo linux, if that matters any.)
=>
=>That would accept an array pointer and a char as an argument and allow
=>me to put that char at the beginning of the array?
You're not describing shift. You're describing push.
=>
=>If not I can write this but I wanted to try accessing the standard library.
=>(It's for a homework assignment.)
I think you're writing it. It'sabout two lines long :-)

=>
=>Is there a utility other than grep for finding useful functions in the
=>C std library?
yes. Use info, preferably from emacs. The entire info doc is available.


-- 
-Time flies like the wind. Fruit flies like a banana. Stranger things have -
-happened but none stranger than this. Does your driver's license say Organ
-Donor?Black holes are where God divided by zero. Listen to me! We are all-
-individuals! What if this weren't a hypothetical question? [EMAIL PROTECTED]

___
gnhlug-discuss mailing list
[EMAIL PROTECTED]
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss



Re: shift() in C std lib

2002-12-11 Thread bscott
On Wed, 11 Dec 2002, at 1:33pm, [EMAIL PROTECTED] wrote:
> Is there a utility other than grep for finding useful functions in the C
> std library?

  "man" is good.  For string functions, start with "man string".

  If you do not already have a copy, obtain a copy of _The C Programming
Language_, 2nd edition, by K&R.  You must do this if you program in C.  
It's a law.

-- 
Ben Scott <[EMAIL PROTECTED]>
| The opinions expressed in this message are those of the author and do not |
| necessarily represent the views or policy of any other person, entity or  |
| organization.  All information is provided without warranty of any kind.  |

___
gnhlug-discuss mailing list
[EMAIL PROTECTED]
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss



RE: shift() in C std lib

2002-12-11 Thread Price, Erik


> -Original Message-
> From: Steven W. Orr [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 11, 2002 1:58 PM
> To: Price, Erik
> Cc: [EMAIL PROTECTED]
> Subject: Re: shift() in C std lib
> 
> 
> On Wed, 11 Dec 2002, Price, Erik wrote:
> 
> =>I'm wondering if there's a shift() function (similar to the 
> one in Perl/
> =>PHP/etc) in the C standard library?  (I have access to the C std lib
> =>that comes with Gentoo linux, if that matters any.)
> =>
> =>That would accept an array pointer and a char as an 
> argument and allow
> =>me to put that char at the beginning of the array?
> You're not describing shift. You're describing push.

I thought that push puts it at the end of the array.

> =>
> =>If not I can write this but I wanted to try accessing the 
> standard library.
> =>(It's for a homework assignment.)
> I think you're writing it. It'sabout two lines long :-)

Okay.  I was just wondering if it was predefined.  Thanks!



Erik
___
gnhlug-discuss mailing list
[EMAIL PROTECTED]
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss



RE: shift() in C std lib

2002-12-11 Thread Price, Erik


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 11, 2002 2:00 PM
> To: Greater NH Linux User Group
> Subject: Re: shift() in C std lib
> 
> 
> On Wed, 11 Dec 2002, at 1:33pm, [EMAIL PROTECTED] wrote:
> > Is there a utility other than grep for finding useful 
> functions in the C
> > std library?
> 
>   "man" is good.  For string functions, start with "man string".
> 
>   If you do not already have a copy, obtain a copy of _The C 
> Programming
> Language_, 2nd edition, by K&R.  You must do this if you 
> program in C.  
> It's a law.

I almost got one last night!  Elaine Ashton and Jarkko Hietaniemi
were giving away their book collection at the boston.pm meeting.
Someone got to it right before I got there.

I'll get it at the library.


Erik
___
gnhlug-discuss mailing list
[EMAIL PROTECTED]
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss



Re: shift() in C std lib

2002-12-11 Thread Bob Bell
On Wed, Dec 11, 2002 at 01:59:30PM -0500, Price, Erik <[EMAIL PROTECTED]> wrote:
> > You're not describing shift. You're describing push.
> 
> I thought that push puts it at the end of the array.

You're both wrong.  :-)  You are talking about Perl's unshift routine.

-- 
Bob Bell <[EMAIL PROTECTED]>
-
 "Software gets slower faster than hardware gets faster!"
   -- "Wirth's Law" - Niklaus Wirth, famous computer scientist
___
gnhlug-discuss mailing list
[EMAIL PROTECTED]
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss



Re: shift() in C std lib

2002-12-11 Thread Kevin D. Clark

"Price, Erik" <[EMAIL PROTECTED]> writes:

> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] wrote: 

>>   If you do not already have a copy, obtain a copy of _The C 
>> Programming
>> Language_, 2nd edition, by K&R.  You must do this if you 
>> program in C.  
>> It's a law.
>
> I almost got one last night!  Elaine Ashton and Jarkko Hietaniemi
> were giving away their book collection at the boston.pm meeting.
> Someone got to it right before I got there.

Also check out _C -- A Reference Manual_ by Harbison and Steele.


If you're interested in C++, you might check out the STL -- problems
like what you're alluding to can be easily solved with this library.
But if you're supposed to use C and the C standard library, then this
option is not available to you.

Regards,

--kevin
-- 
Kevin D. Clark / Cetacean Networks / Portsmouth, N.H. (USA)
cetaceannetworks.com!kclark (GnuPG ID: B280F24E)
alumni.unh.edu!kdc

___
gnhlug-discuss mailing list
[EMAIL PROTECTED]
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss



RE: shift() in C std lib

2002-12-11 Thread Price, Erik


> -Original Message-
> From: Kevin D. Clark [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 11, 2002 2:46 PM
> To: Price, Erik
> Cc: [EMAIL PROTECTED]
> Subject: Re: shift() in C std lib
> 
> 
> 
> If you're interested in C++, you might check out the STL -- problems
> like what you're alluding to can be easily solved with this library.
> But if you're supposed to use C and the C standard library, then this
> option is not available to you.

I would like to eventually learn C++.  But first I need to get a bit
more comfortable in C.  (One thing this C class has taught me is a
real appreciation for Java. :)

I'll have to remember STL for later, though.



Erik
___
gnhlug-discuss mailing list
[EMAIL PROTECTED]
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss