Jump to content
Semifinals on October 24 th - 25 th at Expo, Place de Belgique 1, 1020 Ville de Bruxelles, BelgiumFinals on October 31 at Mercedes-Benz Arena Berlin, Platz 1, 10243 Berlin, Germany

Let's say we have this in text.txt. I can read the file like this:

FILE* stats = fopen ("text.txt", "r");while(!feof(stats) and !ferror(stats))    {   fscanf(stats, "%s", &num);        printf("%s\t", num);    }

"num" will contain each word and number. The task is to extract all numbers from the text. Any ideas?

 

i5-4690k, R9 380 4gb, 8gb-1600MHz ram, corsair vs 550w, astrock h97m anniversary.

 

Link to comment
https://linustechtips.com/topic/473261-extract-numbers-from-text-file-c/
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×