472,794 Members | 2,195 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,794 software developers and data experts.

C Run-Time Error R6002

the error code was taken from msdn and it occured in my code as follows;
i am reading buffer from the file :

Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #define SIZE 10
  4. #define DSIZE 5
  5. #define DEPTH 150
  7. //LL structure
  8. typedef struct node* NODE_PTR;
  9. typedef struct node POOL;
  10. struct node{
  12.     int dept;
  13.     int std_num;
  14.     char name[SIZE];
  15.     char lastname[SIZE];
  16.     double cgpa;
  17.     NODE_PTR link;
  19. };
  21. //--main method
  22. int main(void)
  23. {
  24.     NODE_PTR dept[DSIZE];//--departments will be sent to this header...
  25.     NODE_PTR temp;//--used for allocation of new nodes.
  26.     POOL swim[DEPTH];//--send students read from file to pool
  27.     int i = 0;//--counter for struct type swim.
  29.     //--reading from the file Faculty.txt:
  30.     FILE* fp;
  31.     char* file_name = "C:\\Faculty\\Faculty.txt";
  34.     //--open the file and Read it...
  35.     fp = fopen(file_name,"r+");
  37.     //--if there are problems while reading from the file:
  38.     if(fp == NULL)
  39.     {
  40.         printf("There are problems with file reading operations...\n"
  41.             "The program will exit immediately...\n");
  42.         exit(1);
  43.     }
  45.     //--no problems with reading from file , scan the components to the LL structure:
  46.     while(!feof(fp) && i < DEPTH)
  47.     {
  48.         //--node->ordered to be read:dept(int),
  49.         //--------std_num(int),name(charARR),lastname(charARR),cgpa(double)
  50.         fscanf(fp,"%d %d %s %s %lf",
  51.             &swim[i].dept,
  52.             &swim[i].std_num,
  53.             swim[i].name,
  54.             swim[i].lastname,
  55.             &swim[i].cgpa
  56.             );
  57.         i++;
  58.     }//--end of scanning the file
  59.     return 0;
  60. }
that's the code i have the run-time errors , i wonder you have some solutions,
Dec 13 '07 #1
1 3866
for the clarification of the faculty.txt file , it includes
[dept. code] [std.number] [std.name] [std.lastname] [cgpa];
25 190527 Brad Pitt 1.2
Dec 13 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

by: leroybt.rm | last post by:
Can someone tell me how to run a script from a interactive shell I type the following: >>>python filename >>>python filename.py >>>run filename >>>run filename.py >>>/run filename >>>/run...
by: Ed | last post by:
Hello, I took a course in asp about 2 years ago and I was practicing with IIS 5.0. Then I put it down for a while. Now trying to get back to it. I can't run asp files from subdirectories of...
by: orekin | last post by:
Hi There I have been trying to come to grips with Application.Run(), Application.Exit() and the Message Pump and I would really appreciate some feedback on the following questions .. There are...
by: Bob Day | last post by:
Using vs2003, vb.net I start a thread, giving it a name before start. Code snippet: 'give each thread a unique name (for later identification) Trunk_Thread.Name = "Trunk_0_Thread" ' allow...
by: Bryan | last post by:
How can i run a bit of code straight from the IDE? Right now i make a temporary button and put the code behind that, then i run debug mode and click on the button. Is there a way to highlight...
by: Brett Wesoloski | last post by:
I am new to VS2005. I changed my program.cs file to be a different form I am working on. But when I go to run the application it still brings up the form that was originally declared as new. ...
by: Lee Crabtree | last post by:
I remember when I was first getting into .NET Forms programming that there was a rather emphatic rule about not constructing a form before calling Application.Run with it. So this: ...
by: David Thielen | last post by:
Hi; In our setup program how do I determine if I need to run "aspnet_regiis –i" and if so, is there an API I can calll rather than finding that program on the user's disk and calling it? --...
by: traceable1 | last post by:
Is there a way I can set up a SQL script to run when the instance starts up? SQL Server 2005 SP2 thanks!
by: mxdevit | last post by:
Task: run application from ASP.NET for example, you have a button on ASP.NET page, when press this button - one application is invoked. the code to run application (for example, notepad) is...
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
by: Mushico | last post by:
How to calculate date of retirement from date of birth
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.