Hello everyone, I am currently working on a project and have decided to write it in C for a change. One of the requirements for the project is given a .txt file with integers seperated by a space, input then into the program and so on. Normally I would use FSTREAM to get the values from a text file but I cannot because << isn't overloaded etc.
I was looking in some of the functions that stdio.h has and these two seemed promising fgetc and getw. However when I use fgetc I only grab the ascii character values of the numbers and spaces, which would be okay except that say i have the number 23, first it grabs the 2, then the 3, so I cant preform a simple subtraction to get the actual number. and I am not sure how to use getw it doesn't seem to work well for me.
Does anyone have any ideas how I can grab integers from a .txt file without using FSTREAM?
I was looking in some of the functions that stdio.h has and these two seemed promising fgetc and getw. However when I use fgetc I only grab the ascii character values of the numbers and spaces, which would be okay except that say i have the number 23, first it grabs the 2, then the 3, so I cant preform a simple subtraction to get the actual number. and I am not sure how to use getw it doesn't seem to work well for me.
Does anyone have any ideas how I can grab integers from a .txt file without using FSTREAM?