Commit 27d1d5df authored by jinny.wilkin's avatar jinny.wilkin

Structs built, csv built, csv input read, currently unsure how to assign to struct

parent e3db10e5
.vscode/c_cpp_properties.json
File added
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
#define MAXCHAR 1000
typedef struct Pokemon{
int id, height, weight;
char name[11], species[21], type1[8], type2[8], ability[13], evolveTo[11], evolveFrom[11];
bool dimorphic;
} Pokemon;
typedef struct Trainers{
char name[50];
Pokemon owned[];
} Trainers;
typedef struct Pokedex{
Pokemon pokemon[721];
Trainers trainers[];
} Pokedex;
int main(void){
FILE *fp;
char row[MAXCHAR];
int n = 1;
char *holder;
fp = fopen("pokedexREF.csv", "r");
;
while (!feof(fp)){
fgets(row, n, fp);
n++;
holder = strtok(row, ",");
while(holder != NULL){
printf("Token: %s\n", holder);
holder = strtok(NULL, ",");
}
}
return 0;
}
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment