reading files that contain both string and int

txt. file contains
1
2
human#dog#24
cow#fish#64 


how do i turn the .txt file into an array/2d array but also removing the #.

First skip whitespace. Then std::getline string, with # as delimiter. Twice. Last read an integer.

Repeat for each line.
You can use std::getline() whose last parameter is a delimiter which in this case, is '#'.
Topic archived. No new replies allowed.