Ejemplo n.º 1
0
 void test_comment()
 {
     xlnt::workbook wb;
     auto ws = wb.active_sheet();
     auto cell = ws.cell("A1");
     xlnt_assert(!cell.has_comment());
     xlnt_assert_throws(cell.comment(), xlnt::exception);
     cell.comment(xlnt::comment("comment", "author"));
     xlnt_assert(cell.has_comment());
     xlnt_assert_equals(cell.comment(), xlnt::comment("comment", "author"));
     cell.clear_comment();
     xlnt_assert(!cell.has_comment());
     xlnt_assert_throws(cell.comment(), xlnt::exception);
 }
Ejemplo n.º 2
0
int main(int argc, char *argv[])
{
    fn = argv[1];
    FILE *fp;
    fp = fopen(fn, "r");
    char *longs ; // the file is turn into a string
    char *item ;
    int nl;

    char type[512];
    char val_name[512];
    char *val_defn;
    int count ; 

    char key[512];
    struct nlist *kd;

    longs = file_to_string(fp);
    nl = 0;
    clear_comment(longs, ' '); // all the comments region are replaced by blanks
    if ((item = strtok(longs, ";")) != NULL){
        count = item_to_value(item, type, val_name, &val_defn);
        if (count == 3){
            fprintf(stdout, ">> %12s,%12s,%s\n", type, val_name, val_defn);
            nl ++;
            install(val_name, val_defn);
        }
        //fprintf(stdout, "%i: %s\n", nl, item);
    }

    while ((item = strtok(NULL, ";"))!= NULL){
        count = item_to_value(item, type, val_name, &val_defn);
        if (count == 3){
            nl++;
            fprintf(stdout, ">> %12s,%12s,%s\n", type, val_name, val_defn);
            install(val_name, val_defn);
        //fprintf(stdout, "%i: %s\n", nl, item);
        }
    }

    printf("%s\n", "input the key name: ");
    while(scanf("%s", key) !=  EOF){
        kd = lookup(key);
        printf("key(%s) = %s\n", key, (kd == NULL)? "Not found" : kd-> defn);
        printf("%s\n", "input the key name: ");
    }
    
    return 0;
}