Comment by froh
4 years ago
I wonder if then The Right Way of scanf-scanning potentially large strings is the fmemopen route?
/* ... goal: scanf some looong char *s in some loop */
FILE *s_as_FILE = fmemopen(s, strlen(s), "r");
/* loop loop loop */ ... {
fscanf(s_as_FILE, "FORMAT", &v);
}
fclose(s_as_FILE);
fmemopen is around for a while now, it should work with many libc implementations these days.
?
No comments yet
Contribute on Hacker News ↗