LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   reading data from a file (http://www.linuxquestions.org/questions/programming-9/reading-data-from-a-file-126287/)

afrm 12-16-2003 04:53 AM

reading data from a file
 
i got a file which has many data and i need to read it into fields of a Graph struct in an effective way, this means i dont want to be waiting 1hour :P
Each line of the file has info about a node in the Graph. (i hope u know whats a graph struct :D)
if i read it from the top to the bottom, well i might have some core dumps or have to wait 1h .. so i need u to post some suggestions in order to solve this prob. tks

jim mcnamara 12-16-2003 06:43 AM

We can help if you post the code you already have.

afrm 12-16-2003 07:43 PM

my structs are:

Code:

typedef struct Graph *graph;

typedef struct Graph{
  Porta x;
  int **adj;
}Graph;

typedef struct No *no;

typedef struct _No{
  char *name;
  char value;
}No;

typedef struct _portaLogica{
  float delayTime;
  no **input;
  no *output;
  char *function;
  int num_inputs;
}Porta;

The file is something like :

inputs
...
.....

outputs
.....
.....

nor delayTime output num_inputs input1 input2 input-n
nand delayTime output num_inputs input1 input2 input-n
.....
......
.....

/* well its a logic simulator so u see nand, nor .. etc */


All times are GMT -5. The time now is 08:41 PM.