Re: I'm a newb!!
From: osmium (r124c4u102_at_comcast.net)
Date: 10/16/03
- Next message: WW: "Re: How to make C look like C++"
- Previous message: Martijn Lievaart: "Re: Nested Casts"
- In reply to: Ryan Giuliany: "I'm a newb!!"
- Next in thread: thick_kunt_funker: "Re: I'm a newb!!"
- Reply: thick_kunt_funker: "Re: I'm a newb!!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 16 Oct 2003 07:36:50 -0700
Ryan Giuliany writes:
> I'm trying to get a VERY simple program to take the input data and write
it
> to a text file. First of all...is this even possible with out tons of
extra
> code?
>
> Here's what I tried
>
> #include <iostream>
> #include <string>
> using namespace std;
>
> int main()
> {
> string hello;
> cout << "What is your name?\n";
> cin >> hello;
> cin.read >> "c:\teststore.txt"; // trying to make it write to a file.
> cout << "\n" << hello << "\n\n\n";
> return 0;
>
>
> }
cin and cout are rather peculiar things. They are _objects_ that have been
pre-assigned by the compiler before the compiler lets you get control of the
system. cin is normally attached, so to speak, to the keyboard and cout to
the monitor. You want output to go to a file instead of the monitor; so you
must establish your own object, as shown by one of the other posters.
Certain variables and things that are or act like constants (actually often
a _macro_) such as NULL are "pre-used". A nice list of these oddities would
be a good thing to have in a list. I have no such list.
- Next message: WW: "Re: How to make C look like C++"
- Previous message: Martijn Lievaart: "Re: Nested Casts"
- In reply to: Ryan Giuliany: "I'm a newb!!"
- Next in thread: thick_kunt_funker: "Re: I'm a newb!!"
- Reply: thick_kunt_funker: "Re: I'm a newb!!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|