string string_of(vector<int>v){
     string s = string_of(v[0]);
     for(int i=1;i<v.size();++i){
         s = s + "->" + string_of(v[i]);
     }
     return s;
 }
Exemple #2
0
oyster *builtin_open(machine *m){
    ARG(name);
    FILE *in = fopen(string_of(name), "r");
    if (in == NULL)
        toss_signal(make_signal(make_string("File open failure!"), m), m);
    return make_file(in);
}
 void findPath(TreeNode* root,vector<string>&res,vector<int>v){
     v.push_back(root->val);
     if(root->left==NULL&&root->right==NULL){
         res.push_back(string_of(v));
         return;
     }
     
     if(root->left!=NULL)
         findPath(root->left,res,v);
     if(root->right!=NULL)
         findPath(root->right,res,v);
     return;
 }