Like I said earlier.
Code:
#include <stdio.h>
int main(void )
{
static const char filename[] = "file.txt";
FILE *file = fopen(filename, "r");
if ( file )
{
int key;
char tab;
if ( fscanf(file, "%d%c", &key, &tab) == 2 && tab == '\t' )
{
printf("key = %d\n", key);
for ( ;; )
{
int c = fgetc(file);
if ( c == EOF )
{
break;
}
/* do stuff (here I'll just print the character) */
putchar(c);
}
}
fclose(file);
}
else
{
perror(filename);
}
return 0;
}
/* my output
key = 2344321
afldsfjkasldfkjasljkfsajfal;kf;lkkl;adfkl;a.
*/
Although you may want to open the file in binary mode.