Example #1
0
struct text_list *text_list_load(const char *path)
{
	char line[1024];

	FILE *file = fopen(path, "r");
	if(!file)
		return 0;

	struct text_list *t = text_list_create();

	while(fgets(line, sizeof(line), file)) {
		string_chomp(line);
		text_list_append(t, line);
	}

	fclose(file);

	return t;
}
Example #2
0
struct text_list *allpairs_remote_create(const char *path, const char *set)
{
    char line[1024];

    FILE *file = fopen(path, "r");
    if(!file)
        return 0;

    struct text_list *t = text_list_create();
    int i = 0;
    while(fgets(line, sizeof(line), file)) {
        string_chomp(line);
        char *name = string_format("%s_%d_%s", set, i, path_basename(line));
        text_list_append(t, name);
        i++;
    }

    fclose(file);

    return t;
}