Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++.moderated > #7350
| Message-ID | <fefe07b9-5e97-4e4c-83a5-ea8a3558600c@googlegroups.com> (permalink) |
|---|---|
| Newsgroups | comp.lang.c++.moderated |
| From | Elias Salomão Helou Neto <eshneto@googlemail.com> |
| Subject | Re: std::stoi |
| Organization | unknown |
| References | <f62c87eb-2d2a-4f55-a67c-b843efbeee69@googlegroups.com> |
| Date | 2015-11-05 07:25 -0600 |
Em quarta-feira, 4 de novembro de 2015 11:00:50 UTC-2, kiran escreveu:
> I have been using stoi to convert string representation of numbers into
int
> since long. Only recently one such program of mine stopped working giving
> following error:
>
> string_int.cpp: In function 'int main(int, char**)':
> string_int.cpp:29: error: 'stoi' is not a member of 'std'
>
> Here is the code snippet:
>
> std::string newValStr = "777;
> int newValInt = 0;
> newValInt = std::stoi(newValStr);
>
> I looked around internet and there doesn't seem to be any update on it. I
am
> compiling it using g++ on Redhat Linux 6.2 with following gcc version:
>
> gcc version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC)
>
> Has anyone else also faced something similar?
>
Are you including the <string> header? End there is a missing " in the code.
Anyway, if you would like an advise, I'd recommend you to use istringstream
and operator >> in order to perform tihs conversion in a more C++ish way.
Best,
Elias.
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to comp.lang.c++.moderated | Previous | Next — Previous in thread | Next in thread | Find similar
std::stoi kiran <kiran.tangeeda@googlemail.com> - 2015-11-04 06:56 -0600
Re: std::stoi Öö Tiib <ootiib@hot.ee> - 2015-11-05 07:23 -0600
Re: std::stoi James Kuyper <jameskuyper@verizon.net> - 2015-11-05 07:23 -0600
Re: std::stoi Louis Krupp <lkrupp@nospam.pssw.com.invalid> - 2015-11-05 07:24 -0600
Re: std::stoi Frank Tetzel <s1445051@mail.zih.tu-dresden.de> - 2015-11-05 07:23 -0600
Re: std::stoi Elias Salomão Helou Neto <eshneto@googlemail.com> - 2015-11-05 07:25 -0600
Re: std::stoi Francis Glassborow <francis.glassborow@btinternet.com> - 2015-11-05 12:25 -0600
Re: std::stoi kiran <kiran.tangeeda@googlemail.com> - 2015-11-05 15:36 -0600
csiph-web