iam trying to store all the data in to a struct so i can change it later.
//this data is in file
abc 1 11 22
def 2 33
ghi 0 22 11 33
asd 2

i was planing on making a array of structs. so 1st line will have one struct.
2nd line will have 2nd struct.

struct node
{
 char *alp;
  int x;
  int ar[]10;
};

int main()
{
 int i = 0;
    char *array[20];
    struct node buff {NULL, 0, 0000000000};

    while(read one line(LOOP) fscanf())
      - array[i] = buff->alp = abc; 
      - array[i] = buff->x = 1;       
      - array[i] = buff->ar = 22;
      i++;
       }

Recommended Answers

All 5 Replies

Most of your code is pretty bogus... :-(

  1. The structure member ar[] has the size outside of the brackets. Wrong...
  2. The rest of your code is bogus. The initialization of buff is not correct.
  3. What is this while() condition? And what are the minus signs preceeing the array[i] members of the loop?

We ask you to give some of your approach in the program. The program you've written goes for nothing!
so i suggest you to give atleast 60% of your effort!!

@hwoarang69

WE ARE NOT HERE TO DO YOUR PROJECT WORK!!

First of all, i do not care about syntax error. i just need help with logic.

2nd of all, if you really had read my post you would have understand that i am trying to build a data struct that stores data from file.

** VISH0203, I SUGGEST THAT YOU SHOULD READ MY POST BEFORE POSTING.**

fine!! then where is the file declaration?? where the file is opening?? in which mode you are opening the file?? huh!! stop acting smart buddy.. for reading and writing a data to file, you must open the file.. n to store data in file or reading data from file, you have to declare a file pointer...!! NO OFFENCE HERE!

just open a file, in wb+ mode which is most suitable for writing data in file..

can you read?

WHAT PART OF "DONT WRRONG ABOUT SYNTAX" YOU DONT UNDERSTAND?

AND STOP WASTING MY TIME MAN. IF YOU CANT UNDERSTAND WHAT IAM TRYING TO DO, THAN STOP TRYING TO HELP ME. YOU ARE MAKEING NO SCENE.

commented: ROFL "you are making no scene" +0
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.