| | |
Error Message Concerning Reading File From A Drive
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2004
Posts: 1
Reputation:
Solved Threads: 0
I AM RUNNING A PROGRAM THAT DEALS WITH TEXT FILES IN NOTEPAD. I TYPE IN A FAKE SSN AND THE PROGRAM IS TO READ A LIST OF FILES FROM student course. I AM GETTING AN ERROR MESSAGE TELLING ME THAT PROGRAM CAN'T READ FILE. TWO EX OF SSN'S ARE 201235678 AND 123411234. THE FOLLOWING IS SOME OF THE PROGRAM
I WOULD APPRECIATE IF I COULD GET A RESPONSE AS SOON AS POSSIBLE
C++ Syntax (Toggle Plain Text)
#include <iostream.h> #include <iomanip.h> #include <math.h> #include <stdlib.h> #include <fstream.h> #include <ctype.h> #include <conio.h> #include <string.h> struct student { long stud; char lname[12]; char fname[8]; char mi[1]; }; struct Books { char courseID[7]; char title[50]; double price; }; struct title { char courseid[7]; char booktitle[50]; }; struct clas { long studid; char subjid[7]; }; int main () //Beginning of main { char chartest; //reading file ifstream infile("a:studentcourse.txt"); clas *bol[200]; title *pic[200]; student *boc[200]; Books *rec[200]; long ID; int count=0; int couter =0; int cou = 0; char *hold[7]; //SET UP OUT STREAM FOR CURRENT OUTPUT cout << setprecision (2) << setiosflags (ios::fixed) << setiosflags (ios::showpoint); cout<<"\n\n\nENTER STUDENT ID (social security number)\n"; cin >> ID; //reading file while (!infile.eof()) { boc[count] = new student(); infile>>boc[count]->stud>>boc[count]->lname>>boc[count]->fname >>boc[count]->mi; count++; } for(int i = 0; i < count ; i++) { long temp; if(temp == ID) { cout<<boc[i]->lname<<" "<<boc[i]->fname<<" "<<boc[i]->mi; } } cout<<"\n\n"<<setw(15)<<"Enter Y to continue or N to Cancel.\n\n\n"; cin>>chartest; if(chartest == 'n' || chartest == 'N') { getche(); clrscr(); return 0; }//endif cout<<"\n\n\nStudent ID No:"<<setw(25)<<ID;"\n\n"; cout<<"\n\nYou are enrolled in the following classes:\n"; // reading file ifstream infile_fil ("a:studentcourse.txt"); if (infile_fil.fail()) { cout<<"\nThere is a problem locating the input file a:studentcourse.txt.\n"; cout<<"\nCheck that input file is on the correct drive\n"; cout<<"\nand that the name of the file is spelled correctly."; exit (1) ; }
I WOULD APPRECIATE IF I COULD GET A RESPONSE AS SOON AS POSSIBLE
Last edited by alc6379; Dec 8th, 2004 at 6:31 pm. Reason: added [code] tags
It might be a little easier to look at your code if it were enclosed within [CODE][/CODE] tags.
Hmmm. You open a file and never close it, then you open it.
Hmmm. You open a file and never close it, then you open it.
•
•
•
•
Originally Posted by Dave Sinkula
It might be a little easier to look at your code if it were enclosed within [CODE][/CODE] tags.
Hmmm. You open a file and never close it, then you open it.
Alex Cavnar, aka alc6379
>what's the deal with ALL CAPS LATELY?
If you mean [CODE][/CODE], that's how they show up when you hit the button. And that's how they sit in my template text file. Plus sometimes it needs to be said a little louder.
If you meant this post, that was an attempt at sarcasm.
If you mean [CODE][/CODE], that's how they show up when you hit the button. And that's how they sit in my template text file. Plus sometimes it needs to be said a little louder.
If you meant this post, that was an attempt at sarcasm.
•
•
•
•
Originally Posted by Dave Sinkula
>what's the deal with ALL CAPS LATELY?
If you mean [CODE][/CODE], that's how they show up when you hit the button. And that's how they sit in my template text file. Plus sometimes it needs to be said a little louder.
If you meant this post, that was an attempt at sarcasm.
Alex Cavnar, aka alc6379
![]() |
Similar Threads
- Toshiba IDE1 error message (Windows NT / 2000 / XP)
- Error message Apple Reg.ink (Windows NT / 2000 / XP)
- Error message when reading floppy in windows xp pro and dos boot (Storage)
Other Threads in the C++ Forum
- Previous Thread: subracting
- Next Thread: Sorting character arrays!
| Thread Tools | Search this Thread |
api array based beginner binary c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news node numbertoword output parameter pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






