1
0
Fork 0
mirror of synced 2024-11-15 21:48:57 -05:00
ultimate-vim/bundle/snipmate-snippets/c/readfile.snippet
2014-05-09 21:28:39 +02:00

7 lines
198 B
Text

std::vector<char> v;
if (FILE *${2:fp} = fopen(${1:"filename"}, "r")) {
char buf[1024];
while (size_t len = fread(buf, 1, sizeof(buf), $2))
v.insert(v.end(), buf, buf + len);
fclose($2);
}${3}