mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
13 lines
325 B
Plaintext
13 lines
325 B
Plaintext
# -*- mode: snippet -*-
|
|
# key: readfile
|
|
# contributor: Translated from TextMate Snippet
|
|
# name: Read File Into Vector
|
|
# --
|
|
std::vector<char> v;
|
|
if(FILE${TM_C_POINTER: *}fp = fopen(${1:"filename"}, "r"))
|
|
{
|
|
char buf[1024];
|
|
while(size_t len = fread(buf, 1, sizeof(buf), fp))
|
|
v.insert(v.end(), buf, buf + len);
|
|
fclose(fp);
|
|
} |