Exemple #1
0
datatable2::datatable2(unsigned long columns, unsigned long lines)
{
	resize_factor=1.2;
    set_csv_options();
    data=NULL;
	line_count=line_size=0;
	column_count=column_size=0;
	resize(columns, lines);
    clear_titles();
}
Exemple #2
0
// class constructor
datatable2::datatable2()
{
	resize_factor=1.2;
    set_csv_options();
    data=NULL;
	line_count=line_size=0;
	column_count=column_size=0;
	title_line="";
	resize(2,10);
	clear_titles();
}
Exemple #3
0
static int collector_open(OBJECT *obj)
{
	char32 type="file";
	char1024 fname="";
	char32 flags="w";
	TAPEFUNCS *tf = 0;
	struct collector *my = OBJECTDATA(obj,struct collector);
	
	my->interval = (int64)(my->dInterval/TS_SECOND);

	/* if prefix is omitted (no colons found) */
	if (sscanf(my->file,"%32[^:]:%1024[^:]:%[^:]",type,fname,flags)==1)
	{
		/* filename is file by default */
		strcpy(fname,my->file);
		strcpy(type,"file");
	}

	/* if no filename given */
	if (strcmp(fname,"")==0)
	{
		char *p;
		/* use group spec as default file name */
		sprintf(fname,"%s.%s",my->group,my->filetype);

		/* but change disallowed characters to _ */
		for (p=fname; *p!='\0'; p++)
		{
			if (!isalnum(*p) && *p!='-' && *p!='.')
				*p='_';
		}
	}

	/* if type is file or file is stdin */
	tf = get_ftable(type);
	if(tf == NULL)
		return 0;
	my->ops = tf->collector;
	if(my->ops == NULL)
		return 0;
	set_csv_options();
	return my->ops->open(my, fname, flags);
}