read-file-(readF).sublime-snippet (435B)
1 <snippet> 2 <description>Read File Into Vector</description> 3 <content><![CDATA[std::vector<char> v; 4 if (FILE${TM_C_POINTER: *}fp = fopen(${1:"filename"}, "r")) 5 { 6 char buf[1024]; 7 while (size_t len = fread(buf, 1, sizeof(buf), fp)) 8 v.insert(v.end(), buf, buf + len); 9 fclose(fp); 10 }]]></content> 11 <tabTrigger>readfile</tabTrigger> 12 <scope>(source.c++ | source.objc++) - meta.preprocessor.include - comment - string</scope> 13 </snippet>