- testscanf.cc
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
int main(int argc,const char *argv[]) {
char buffer[101];
uint64_t count;
FILE *file = fopen("1.txt","r");
for(int i=0;!feof(file);++i){
int result = fscanf(file,"%s %" PRId64 ,buffer,&count);
printf("%d %d %s\n",result,count,&buffer);
}
}
cat 1.txt
aa 1 11
bb 2 22
cc 3 33