Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6033601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:30:25+00:00 2026-05-23T05:30:25+00:00

struct recordNode { char district[50]; int employees; int employers; int students; int retried; int

  • 0
struct recordNode {
   char district[50];
   int employees;
   int employers;
   int students;
   int retried;
   int others;
   struct recordNode* left;
   struct recordNode* right;
};

FILE *getFile (char filename[]) {
   struct recordNode* node;

   FILE* fpin;
   FILE* fpout;

   char line_buffer[lineSize]; /* BUFSIZ is defined if you include stdio.h */
   int counter = 0;
   filename = "testData.txt";

   //file validation
   fpin=fopen("testData.txt", "r");

   if (fpin == NULL ) exit(0);
        counter = 0;
    while (fgets(line_buffer, sizeof(line_buffer), fpin)) { /* same as while (feof(in) != 0) */
               counter++;
               if (counter != 0) {
                //Central & Western - Chung Wan,7576,1042,2156,1875,3154 (sample data)
               sscanf(line_buffer, "%s,%d,%d,%d,%d", node->district, node->employees, node->students, node->retried, node->others);
               printf("%s", node->district); **//error**
               }


               getchar();



    }
        getchar();

   return fpout;
}

i got a error when i compile, what’s wrong with my code? There is a error message
Project Project1.exe raised exception class EAccessViolation with Message ……………….. (borland C++)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T05:30:26+00:00Added an answer on May 23, 2026 at 5:30 am

    Your problem (or at least one of them) is here:

    sscanf(line_buffer, "%s,%d,%d,%d,%d", node->district, node->employees, 
                          node->students, node->retried, node->others);
    

    all except the first of those parameters should be pointers:

    sscanf(line_buffer, "%s,%d,%d,%d,%d", node->district, & node->employees, 
                          & node->students, & node->retried, & node->others);
    

    Also, this:

    filename = "testData.txt";
    

    shouldn’t be there at all – the name of the file to read is passed in as a parameter to the function.

    And lastly, this:

     struct recordNode* node;
    

    should be:

     struct recordNode node;
    

    and you need to change things like node->district to node.district. This is tiring work – perhaps you could put a bit more effort into chasing these things down before posting here. You will learn much more that way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

struct Ternary { char current; bool wordend; Ternary* left; Ternary* mid; Ternary* right; Ternary(char
struct node{ double dat; char oper; node *left,*right; } vector <node> data; vector <node>
struct elem { int i; char k; }; elem user; // compile error! struct
struct { char a; int b; } x; Why would one define a struct
struct person { int age; char name[100]; struct person *next; }; void delfirst(struct person
struct Test { int var; char *arr; } int main() { Test a; a.arr
struct dataStruct { const char* s; int num; }; struct Final_struct { int n;
struct Dummy { int x; char y; }; int main() { struct Dummy dum;
struct st1{ int a:1; int b:3; int c:6; int d:3; }s1; struct st2{ char
struct Item { int i; char * x; }; Item all[] = { {0,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.