[Tutor] Questions about stdin, stdout, lists and tuples

D-Man dsh8290@rit.edu
Mon, 8 Jan 2001 13:24:28 -0500

On Mon, Jan 08, 2001 at 01:40:16PM -0800, Sheila King wrote:
| Yes, I can't really figure out how to use procmail on my webhost, and believe
| me, I've tried. My web host is fantastic, but uses a proprietary mail system,
| and no one has yet figured out how to use procmail, although it is installed.

If it is a Unix box, and if it follows conventions (standards?) you
could put "| /usr/bin/procmail" in a file called '.forward' in your
home directory.  Otherwise enjoy working with python instead ;-).



| :| ----------------------------------------
| :| #include <iostream.h>
| :| #include <string.h>
| :| 
| :| int main()
| :| {
| :|    string line;
| :|    getline(cin,line);
| :|    cout << line;
| :|    return 0;
| :| }
| :| ----------------------------------------
| :
| :I'm not familiar with the getline() fuction in C++ (I don't recall
| :seeing it in my C++ book, but it would have been useful many times).
| :If I can assume that it will read all characters on cin until it finds
| :a newline and inserts it into the string 'line', then that is the
| :same.
| Yes, this is what it does. You need to include string.h for this ability. And
| it strips the newline character when it does this.

I believe Python's readline() keeps the newline character.

I am curious now as to your C++ compiler's environment.  
#include <string.h>
usually includes a header file that is part of the C standard library
and contains only C string manipulation functions.

#include <string>
will inlclude the C++ standard library's string class declaration.
(If the compiler conforms to the ANSI standard of leave the '.h' off
of include files)

Interesting that you include string.h and get C++ fuctionality from
it.  (I've tried before but get a "type expected instead of 'string'"
error message)