Ignoring invalid characters how?
Another major problem, which is underlying most of my other problems, is how to reference this array that I've built up:
Code:
struct kampdata
{
char dato[STRENG_LAENGDE_MAX],
tid[STRENG_LAENGDE_MAX];
};
typedef struct kampdata kampdata;
kampdata data[LINJER_MAX];
char linje[LINJE_LAENGDE_MAX];
int linjeNr = 1;
FILE *inputfil;
int main()
{
inputfil = fopen("superliga-2011-2012.txt", "r");
if (inputfil != NULL)
{
while (linjeNr < LINJER_MAX && fgets(linje, LINJE_LAENGDE_MAX, inputfil) != NULL)
{
sscanf(linje, "%s %s\n", data[linjeNr].dato, data[linjeNr].tid);
linjeNr++;
}
fclose(inputfil);
}
printf("%s\n", data[8].dato);
I got it working, and have no problem printing out all [linjeNr] values of for example data[linjeNr]dato
But when I want to reference it within a function, for example in regards to this string-to-int-conversion, I'm compiling fine but get no result..
Edit: apologies if this code was too much off-topic, I'm just a little stressed with this assignment