replace substr

How can I replace substr when using information from txt file to display on your file.

1
2
3
4
5
6
7
8
9
10
11
string find_number(string line) {
    return line.substr(0, 6);
}
double get_balance(string line){
    string n= line.substr(7, 10);
    float m= atof(n.c_str());
    return m;
}
string find_name(string line){
    return line.substr(18);
}
Last edited on
Can you explain what are you doing with the stringstream now?
Actually forget getting rid of stringstream, how do i replace the try-catch statements.
I was wondering why you even had try/catch blocks.

Line 46,53: open does not throw, so no reason for a try catch block. Use is_open().

Line 81,98: What do you think is going to throw here?



With what? What role do the try-catch statements serve in your program?
Topic archived. No new replies allowed.