Created
June 21, 2011 20:29
-
-
Save Steve-V/1038815 to your computer and use it in GitHub Desktop.
deadnuts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int process_employee(string SourceName,int Position, int& Employee,int& Time,double& PayRate) | |
{ | |
int EOF_Flag=0; | |
string line; | |
ifstream SourceFile; | |
SourceFile.open(SourceName.c_str()); | |
if (SourceFile.fail()) | |
{ | |
cout << "\nThe file couldn't be opened please make sure it is there\n"; | |
exit(1); | |
} | |
for (int j = 1; j < Position; j++) | |
getline(SourceFile,line); | |
if (SourceFile.good()) | |
{ | |
SourceFile >> Employee >> PayRate >> Time; | |
} | |
else | |
{ | |
EOF_Flag=1; | |
} | |
string deadnuts; | |
SourceFile >> deadnuts; | |
//check and see if there's any more data waiting - dont use EOF() function | |
//if deadnuts is blank that means there is no more data waiting in the file | |
if (deadnuts == "") | |
{ | |
EOF_Flag = 1; | |
} | |
SourceFile.close(); | |
return EOF_Flag; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment