PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.cplus > cin src
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
cin src

Réponse
 
LinkBack Outils de la discussion
Vieux 17/10/2007, 11h39   #1
America01@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut cin src

Hello, I am new to C++ and I had a question I couldn't seem to find a
answer to. I want to see the source of cin, I am running Linux and I
went into /usr/include and didn't find anything retaining to cin. Is
there even a source file for cin? I would assume so since it's a
function...

Thanks for your time.

  Réponse avec citation
Vieux 17/10/2007, 11h49   #2
Neelesh Bodas
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: cin src

On Oct 17, 3:39 pm, Americ...@gmail.com wrote:
> Hello, I am new to C++ and I had a question I couldn't seem to find a
> answer to. I want to see the source of cin, I am running Linux and I
> went into /usr/include and didn't find anything retaining to cin. Is
> there even a source file for cin? I would assume so since it's a
> function...
>
> Thanks for your time.


The contents of istream class can be seen in <iostream> header. Its
declaration can be found in <iostream>
extern istream cin;

The contents of class istream can be found in header <istream>. class
istream is actually a typedef.
typedef basic_istream<char> istream

-N

  Réponse avec citation
Vieux 17/10/2007, 12h10   #3
Neelesh Bodas
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: cin src

On Oct 17, 3:49 pm, Neelesh Bodas <neelesh.bo...@gmail.com> wrote:
> On Oct 17, 3:39 pm, Americ...@gmail.com wrote:
>
> > Hello, I am new to C++ and I had a question I couldn't seem to find a
> > answer to. I want to see the source of cin, I am running Linux and I
> > went into /usr/include and didn't find anything retaining to cin. Is
> > there even a source file for cin? I would assume so since it's a
> > function...

>
> > Thanks for your time.

>
> The contents of istream class can be seen in <iostream> header. Its
> declaration can be found in <iostream>
> extern istream cin;


Typo. Meant this -

cin is an object of istream class. The declaration of cin can be
found in <iostream> header.
extern istream cin;

-N


  Réponse avec citation
Vieux 17/10/2007, 14h08   #4
Stuart Redmann
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: cin src

America01@gmail.com wrote:
> Hello, I am new to C++ and I had a question I couldn't seem to find a
> answer to. I want to see the source of cin, I am running Linux and I
> went into /usr/include and didn't find anything retaining to cin. Is
> there even a source file for cin? I would assume so since it's a
> function...


If you want to use 'cin' as a programmer, you should not care much about it,
'cin' is just there. You should be aware that cin, being an istream-object, is
just an interface that you can use to retrieve data. What the actual source of
the data is, depends on how the executable/binary on your system had been
launched (for example the user may have 'piped in' the contents of a file). Thus
it is up to C++ run-time environment to provide you with the proper object
behind 'cin' (which would be either a ifstream or some other stream that is tied
to the console). This is all very platform dependent, and thus off-topic in this
newsgroup.

As a user of 'cin' you should write code that does not depend on which data
source for 'cin' is actually used.

Regards,
Stuart
  Réponse avec citation
Vieux 17/10/2007, 15h51   #5
Dan Noland
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: cin src

On Oct 17, 6:39 am, Americ...@gmail.com wrote:
> Hello, I am new to C++ and I had a question I couldn't seem to find a
> answer to. I want to see the source of cin, I am running Linux and I
> went into /usr/include and didn't find anything retaining to cin. Is
> there even a source file for cin? I would assume so since it's a
> function...
>
> Thanks for your time.


My debian install does have the source for iostream. It is located in /
usr/include/c++/4.1.3/iostream

According to dpkg this file was installed by the package libstdc+
+6-4.1-dev. You may need to install the libstdc++ development package
for your distribution/compiler in order to mess with it. As previous
posters have mentioned, this is strongly advised against. Any error
you might see in istream is almost certainly the result of the misuse
of an istream object and NOT a bug in the standard c++ library.

If you are just curious what is in there, and you should be, then look
here:
http://gcc.gnu.org/onlinedocs/libstd...am-source.html
and here
http://gcc.gnu.org/onlinedocs/libstd...am-source.html

YT,
Dan Noland
http://nolandda.org/

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 23h41.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,09568 seconds with 13 queries