Reading only the digits from a text file to a string

Hello

I need the cpu load for my project - since googling for weeks didnt help (everything i found about getting the cpu load wont compile, or the code breaks while converting for VS 2013) i'd just use cmd with the wmic command and save the load in a textfile.
it puts to the textfile:
1
2
3
LoadPercentage    
25                  

line 3 exists, but no characters are written to it.
Also there are plenty of spaces after LoadPercentage and the number.
i need only the number from that textfile in a string, converting to an int can be done later i guess.

i'm planning to have it like this:
1.getting cpu load with cmd, writing the log to textfile.txt
2. reading the textfile, getting only the number/remove everything but the numbers and get it in a useful format
(3. processing the data)
4. repeat

is there a good way to do it?

using Visual Studio 2013

I'd appreciate it, if someone could help me.

kind regards
Topic archived. No new replies allowed.