#include<stdio.h> int main(void) { FILE *fp; fp = fopen("sample.txt", "r"); char buf[101]; while(fgets(buf, 100, fp)){ int i, j; char p[10]; sscanf(buf, "%d\t%[^\t]\t%d\n", &i, p, &j); // ←間違ってる? printf("%d,%s,%d\n", i, p, j); } fclose(fp); return 0; } sample.txt ---------- 2 BB 3 1 4 --------------------- output--------------- 2,BB,3 1,4 ,3 ---------------------