Help displaying numbers from text file

I am having trouble displaying the numbers from a text file. When I run the program all it displays is garbage numbers instead of the numbers from the file:

-858993460 is what it displays 20 times.

Heres a sample of the text file that I am trying to display:
8722629427799992984

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179

#include <iostream>
#include <stdio.h>		            // Need for getchar
#include <fstream>                  // Need for files
#include <string>
#include <cstring>

using namespace std;

string getInputFileName(); // a function to prompt for the complete file name

void sort(int myArray[],int size);

int binsearch(int myArray[], int key, int left, int right);


int main ()
{
const int v = 100, k = 20;
int keys[k];
int j=0, l=0;
int value[v];
string f_Name;
ifstream keyinF, valueinF;
string keyfileName,valuefileName;
keyfileName = getInputFileName(); // prompt and obtain the full file name
//valuefileName = getInputFileName();



  while ( !keyinF.eof())
 {
for (j = 0; j < k; j++)
	{
		keyinF >> keys[j];
		
	}
  }
	keyinF.close();
  for (j = 0; j < k; j++)
    cout<<keys[j]<<endl;
  
  
  
  cin.get();




/*while (!valueinF.eof() && l > 100)
 
{
valueinF >> value[l];
l++;
cout << "test2" << endl;
}
*/
  


  
   
  	//keeps the output window open
	cout << "Press enter to continue \n"; 
	cin.ignore();
	char ch = getchar();

  return 0;
}




//**************************************************************************************/
//
// Function name: getInputFileName
//
// Purpose: to prompt for the fully qualified name of a file
//              i.e. including the path of the file
//
// Input parameters: none
//
// Output parameters: none
//
// Return Value: a string containing the fully qualified name
//               of a file
//
//**************************************************************************************/

string getInputFileName( )
{
  string inFileName;
  ifstream inFile;

  cout << " \n Please enter the fully qualified name of \n"
  << " the input text file, including the path: ";

  cin >> inFileName;

  cout << endl;

  inFile.open( inFileName.c_str());                                    //try to open

  if ( ! inFile )                                                      //test if open
    {
      cerr << " cannot open file: " << inFileName << endl << endl;
      //exit(-1);
    }

  return inFileName;
}


//**************************************************************************************/
//
// Function name: binsearch
//
// Purpose: to prompt for the fully qualified name of a file
//              i.e. including the path of the file
//
// Input parameters: none
//
// Output parameters: none
//
// Return Value: a string containing the fully qualified name
//               of a file
//
//**************************************************************************************/

void sort(int myArray[],int size)               //sorts the array in ascending array using bubble sort
{
     int temp;
 
     for(int i=0;i<size;i++)
         for(int j=0;j<size-i-1;j++)
          if(myArray[j]>myArray[j+1])
               {
                temp=myArray[j];
                myArray[j]=myArray[j+1];
                myArray[j+1]=temp;
 
               }
 
}


//**************************************************************************************/
//
// Function name: binsearch
//
// Purpose: to prompt for the fully qualified name of a file
//              i.e. including the path of the file
//
// Input parameters: none
//
// Output parameters: none
//
// Return Value: a string containing the fully qualified name
//               of a file
//
//**************************************************************************************/

int binsearch(int myArray[], int key, int left, int right) 
{
	int mid;
      mid = (left + right) / 2;

	  if (right < left)
		  return -1;
	  else
		  if (key == myArray[mid])
                  return mid;
		  else
			  if (key < myArray[mid])
				  return binsearch(myArray, left, mid-1, key);
			  else
				  return binsearch (myArray, mid+1, right, key);
      }


Any help would be greatly appreciated.
You never open the stream keyinF
Thanks I didn't even realize I didn't open the file.
Topic archived. No new replies allowed.