Hello, I'm super new to c programming. Having alittle trouble with something.
I'm trying to read a file into a 2 dimensional array. contents of the file are as such :
coderoduct
231231:canofsoop
231231izza
213124op
list does not exceed 1000.
I have a variable from another function (the name of product). I need to scan the array for the name and if it exist get the code#.
this is what i have so far
&type is the address of name of product from another function.Code:void Search(char product, int *code) { char &type, char productname[1000], int codenumber[1000], int i; FILE *fp; fp = fopen("product.dat", "r"); for (i = 0; i < 1000; i++) fscanf(fp, "%d:%c\n", codenumber[i], productname[i]);} ???? ??? rewind(fp); fclose(fp); }
after i scan the file i'm lost >.<
how do i scan the productnames for the &type and get the code??
any help at all will be much appreciated!
im so confuseled!



LinkBack URL
About LinkBacks
roduct


