Okay so I'm REALLY new at this whole C stuff :-/ and I need some help. Im workin on a program and so far this is what I have..
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#define MAXL 200
#define MAXSNG 99
void FRNL (char input[MAXSNG][MAXL], int size)
{
int i, j;
for (i=0; i<size; i++)
{
j=0;
while (input[i][j]!= '\n' && input[i][j]!='\r')
{ j++;
}
input[i][j] = '\0' ;
}
}
int main()
{
FILE *in_f, *out_f;
int playtimes[MAXSNG];
int i=0;
char names [MAXSNG][MAXL];
in_f = fopen("songdata.txt", "r");
assert(in_f);
out_f = fopen("output.txt", "w");
if (!in_f)
{
printf("could not open file\n");
exit(0);
}
while (fscanf (in_f, "%d", &playtimes[i]==1)
{
fgets(names[i], MAXL, in_f); i++}
}
FRNL (names, i);
for (j=0; j<i; j++)
{
printf(%d %s", playtimes[j], names[j];
}
return 0;
}
when I compile thought I get these errors:
program4.c:37: warning: comparison between pointer and integer
program4.c:37: warning: format argument is not a pointer (arg 3)
program4.c:38: error: syntax error before '{' token
program4.c:39: error: syntax error before '}' token
program4.c:26: warning: unused variable `names'
and I can't figure out why! I know that I did this same code in class today and it compiled fine, but i must have missed something in my notes.. because now it wont work :( Can you help me? :-D