13 Topics

Member Avatar for
Member Avatar for mystycs

I have a string and i want to conver the part of it to an int. I want to convert the part of the string `input[1]` to an int. But my compiler cant use atoi, or stoi.. I saw a ifstringstream option i think can work, but i tried implementing …

Member Avatar for tinstaafl
0
323
Member Avatar for dospy

the basic idea is that i have a config file where i need to take entries in different formats(the key is always a string and the value could be any type: int, float, string etc) from and the file has the following style: firstentry 1.5 secondentry 35 thirdentry somestring and …

Member Avatar for sepp2k
0
385
Member Avatar for tristanhall

I'm trying to make a program for my computer science class and it requires that I run output to the console as well as to a file. I'm looking for a way to intialize a string at the beginning of the program and pass the variable by reference to my …

Member Avatar for tristanhall
0
301
Member Avatar for BCBTP

Hello, people on daniweb. I was programming in C++CX for a metro application I am making, and needed to do a little string manipulation. Does anyone know if there is a way to individually edit members of String^, like an array, or if there is some equivalent to stringstream on …

Member Avatar for thines01
0
283
Member Avatar for thecoolman5

hi, i have this code: [CODE]#include<iostream> #include<sstream> #include<string> using namespace std; int main (char argc) { string n1 = "141+246+3+64"; int n2; int pos = -1; char toFind = '+'; do { pos = n1.find(toFind, pos+1); if(pos != -1) { stringstream(n1) >> n2; cout << n2 << endl; cout << …

Member Avatar for thecoolman5
0
293
Member Avatar for thecoolman5

hi, I am trying to make a calculator and I need the stringstream function to convert a a certain part of a string.[CODE]string n1 = "243+79"; int n2 = 0; stringstream(n1[0-2]) >> n2; // this converts the 243 from n1 to an int[/CODE] Any solutions?

Member Avatar for thecoolman5
0
336
Member Avatar for thecoolman5

hi, i am trying to make a calculator and i have this code [CODE]#include<iostream> #include<sstream> using namespace std; int main (char argc) { int l = 1; for(l = l; l > 0; l--) { int q = -2; string n1 = "1+5"; int n; int e; stringstream(n1[q=q+2]) >> n; …

Member Avatar for mike_2000_17
0
1K
Member Avatar for n0de

Hi, i'm getting only one digit after floating point after conversion from string to float. Have tryed from standart functions to i don't know.. the problems is that conversion whatever it would be (strtod(), stringstream >> float, atof(), don't even rembember all other wacky ways to do that) brings me …

Member Avatar for n0de
0
198
Member Avatar for embooglement

I'm trying to write a to string function that would use std::stringstream to convert the the instance data into a string, but haven't been able to get operator overloading to work with it. As soon as I define a new << operator, I get a bunch of ambiguity errors saying …

Member Avatar for embooglement
0
2K
Member Avatar for embooglement

I'm developing a game engine, and set up a function that uses string streams to convert various values into std::string's. To use this to string function on class obviously takes an overloaded insertion operator, which I have done for a transformation matrix class here: [code] typedef std::stringstream StreamString; StringStream& operator<<(StringStream& …

Member Avatar for embooglement
0
1K
Member Avatar for barevhayerable

Hello everybody, is there somebody that can help?? I'm having string (my example in string 55+22)that must be inputed by keyboard .. the first part I've done to put 55 to another array 2(with strtok function) Now that I was tries for many hours to put 22 to an other …

Member Avatar for abhimanipal
0
378
Member Avatar for fantum

hello, [B]I have an assignment for my one class at school where I am supposed to write a program that creates lists of people who have met. Each line of input is a space-separated list of the names of people who have met. If a person is in a group …

Member Avatar for Fbody
0
135
Member Avatar for TimeFractal

Hello, I need to simulate a stream which behaves exactly like a ostringstream, except when handling objects of type color. What is the best way to do this? [code] user.display() << color() << "Name: " << color(color::Red) << setw(10) << left << str_name << endl << color() << "Date: " …

Member Avatar for TimeFractal
0
2K

The End.