Semi-newbie needs help
OK ive been learning C++ recently, and I think I am catching on pretty quick because of my experience in RPG Maker 2000....C++ is surprisingly similar. I feel so weird, being a n00b again, because for about 2-3 years i have been helping n00bs in RM2k! Anyways....I have a prob. My C++ compiler is about 5 yrs old (heh) and I seem to be missing something. What file do you #include to use getline()? The book I am learning with says fstream.h or iostream.h, but my old files dont seem to have it. Can somebody send me the file that actually works with getline()? rpgman6488@mail.com is my email, any help is EXTREMELY appreciated.
EDIT:THE PROBLEM IS FIXED
| Chikara Productions | Random Quote:There are those who I would take a bullet for, and those who I would like to put a bullet in.
[edited by - RPGman6488 on December 30, 2002 12:37:01 PM]
| Chikara Productions | Random Quote:There are those who I would take a bullet for, and those who I would like to put a bullet in.
quote: Original post by RPGman6488and which compiler/version might that be?
My C++ compiler is about 5 yrs old (heh)
btw, I don''t recall there being any standard function called getline(). There is a member function of the istream class, declared in <iostream>, ie:
#include <iostream>int main () { char name[256]; std::cin.getline (name,256);}
supposedly there is a getline() command, or so it says in a tut i am using....and its Borland C++ compiler from 1997.
| Chikara Productions | Random Quote:There are those who I would take a bullet for, and those who I would like to put a bullet in.
| Chikara Productions | Random Quote:There are those who I would take a bullet for, and those who I would like to put a bullet in.
| Chikara Productions | Random Quote:There are those who I would take a bullet for, and those who I would like to put a bullet in.
I haven''t used borland, but assuming standard compliance, you should be able to substitue your getline() with fgets(), declared in <stdio.h>. If that is not sufficient, please post some of the code you''re refering to, as we can see the context of the function.
quote: Original post by CWizard
btw, I don''t recall there being any standard function called getline().
It''s defined in <string>.
template<typename _CharT, typename _Traits, typename _Alloc>inline basic_istream<_CharT,_Traits>&getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Alloc>& __str);
[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Fruny said:
"It's defined in string."
NO it isnt, atleast not in my version. I #include string, and it doesnt work. If yours does, could you send me yours? rpgman6488@mail.com
thanx everybody for the help
| Chikara Productions | Random Quote:There are those who I would take a bullet for, and those who I would like to put a bullet in.
[edited by - RPGman6488 on December 29, 2002 7:29:39 PM]
"It's defined in string."
NO it isnt, atleast not in my version. I #include string, and it doesnt work. If yours does, could you send me yours? rpgman6488@mail.com
thanx everybody for the help
| Chikara Productions | Random Quote:There are those who I would take a bullet for, and those who I would like to put a bullet in.
[edited by - RPGman6488 on December 29, 2002 7:29:39 PM]
| Chikara Productions | Random Quote:There are those who I would take a bullet for, and those who I would like to put a bullet in.
Fruny is correct. However, I believe that your compiler (being from 1997, as you say) predates the standard he refers to. You might want to look into getting a newer compiler, such as a recent version of Dev-C++ (avalailable at www.bloodshed.net). As for Borland's compilers I do not know: They have released a free (command line) compiler, but how recent (or standards compliant) it is, I do not know.
[edited by - Miserable on December 29, 2002 9:19:17 PM]
[edited by - Miserable on December 29, 2002 9:19:17 PM]
Sorry for missleading info (although I didn''t say there wasn''t any such function, but that I didn''t recall one). For some reason I assumed you refered to a C (not C++) function.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement