0

Hello everyone~!
I have a text file with integers on every line like:

2397
4013
9382
5995
4961
9961
1535
146
8153
3877
5872
2690
9731
8060
8452
7873
1109
4152
7256
2437
6815
2032
2473
1090
5674
6096
7868
422

My problem is: Im not sure how to store the information so i can sort it. I was able to get the information out of the txt file but when i sort it, the sort does not work. (the way i got the information is bad?)

 char temp[50] = {0};
    //get input store it in the array
          //array should be filled
          for(i=0;i<sizeof(sortArray);i++)
          {
              while(!feof(inFile))
              {
               fgets(temp,sizeof(temp),inFile);
                strcat(sortArray,temp);
              }
          }

Where do i start?

Edited by brandon66

1
Contributor
1
Reply
15
Views
2 Years
Discussion Span
Last Post by brandon66
0

I should use an integer array, and then use fscanf for to get input?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.