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

#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

It might be a little easier to look at your code if it were enclosed within code tags.

Hmmm. You open a file and never close it, then you open it.

It might be a little easier to look at your code if it were enclosed within code tags.

...I went ahead and added the tags, but what's the deal with ALL CAPS LATELY?

what's the deal with ALL CAPS LATELY?

If you mean 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.

Oh... no no no... not you... I mean everyone else. Your capitalization habits are sane, AFAICT. ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.