•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 391,574 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,861 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser:
Views: 2931 | Replies: 5
•
•
Join Date: Dec 2004
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
Hello,
This is my first post. Anyway.. I am having trouble with my c++ program. My assignment is to read from a file a 2-Dimensional array. However, when attempting to do so with my code, which i'm guessing is faulty, I keep getting this error while using Borland Turbo C++ 4.5:
General Protection Exception
0x9CF7:0x4D58
Program2(1) 0x9CF:0x4D58 Processor Fault
Here is my code and I have also attached my files:
If anyone can help it would be greatly appreciated! THANKS!
This is my first post. Anyway.. I am having trouble with my c++ program. My assignment is to read from a file a 2-Dimensional array. However, when attempting to do so with my code, which i'm guessing is faulty, I keep getting this error while using Borland Turbo C++ 4.5:
General Protection Exception
0x9CF7:0x4D58
Program2(1) 0x9CF:0x4D58 Processor Fault
Here is my code and I have also attached my files:
#include <iostream.h>
#include <iomanip.h>
#include <math.h>
#include <stdlib.h>
#include <fstream.h>
#include <ctype.h>
int grade[15][6];
/********************************************************/
void fileopen()
{
char ch;
fstream Infile;
Infile.open("program2.txt", ios::in);
if (!Infile)
{
cout<<"File not found!";
}
int i=0, h=0;
while (ch = Infile.peek() != EOF)
{
Infile >> grade[i][h];
i++;
h++;
}
Infile.close();
}
/********************************************************/
int displaygrades()
{
fstream Infile;
for (int i=0; i < 15; i = i + 1) {
for(int h=0; h < 6; h = h + 1){
Infile << grade[i][h] <<"\n";
}
}
}
/********************************************************/
int main()
{
fileopen();
displaygrades();
return 0;
}If anyone can help it would be greatly appreciated! THANKS!
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
- general protection error (C++)
- Help!!!!!! General Protection Exception (C++)
- IEXPLORE caused a general protection fault (Web Browsers)
- I keep getting an error message on my computer called General Protection Exception... (C++)
Other Threads in the C++ Forum
- Previous Thread: Need help with this conversion program
- Next Thread: C++ Data Types



Threaded Mode