I have next structure of my program:

Code:
typedef struct {	
	char* art;  //Code of product
	char* naim; //Name of product
	char* model;
	int*  cena; //Price
	char* year; 
	char* pro;  //Country 3 characters
} TOVARS;

TOVARS my_tov[1000];

var number_of_str = 0; // keeps the number of stored strings
var save_enabled = 0; // will be set to 1 when the information has been updated
var index;

TEXT* temp_art = {strings = 1000;} // these arrays store the data that is read using file_str_readto in main
TEXT* temp_naim = {strings = 1000;} // for the authors, books, years and editors
TEXT* temp_model = {strings = 1000;}
TEXT* temp_cena = {strings = 1000;}
TEXT* temp_year = {strings = 1000;}
TEXT* temp_pro = {strings = 1000;}

STRING* art_str = "    "; // holds up to 4 characters
STRING* naim_str = "                    "; // holds up to 20 characters
STRING* model_str = "                     "; // holds up to 20 characters
STRING* cena_str = "                    "; // holds up to 20 characters
STRING* year_str = "                    "; // holds up to 20 characters
STRING* pro_str = "                    "; // holds up to 20 characters

function save_data()
{
	//if (!save_enabled) {return;} // don't allow saving if the data hasn't been updated
	var filehandle;
	index = -1;
	filehandle = file_open_write ("strings1.txt"); // open this file (or create and open it)
	file_var_write(filehandle, number_of_str); // write the number of strings
	file_close(filehandle); // now close the file
	wait (3);
	filehandle = file_open_write ("Tovar.txt"); // open the database.txt file
	while (index < (number_of_str - 1))
	{
		index += 1;

		my_tov[index].art = (temp_art.pstring)[index]; // copy the information from the strings to the struct
		my_tov[index].naim = (temp_naim.pstring)[index];
		my_tov[index].model = (temp_model.pstring)[index];
		my_tov[index].cena = (temp_cena.pstring)[index];
		my_tov[index].year = (temp_year.pstring)[index];
		my_tov[index].pro = (temp_pro.pstring)[index];

		file_str_write(filehandle, (temp_art.pstring)[index]); // write the information to the file using commas as separators
		file_str_write(filehandle, ",");
		file_str_write(filehandle, (temp_naim.pstring)[index]);
		file_str_write(filehandle, ",");
		file_str_write(filehandle, (temp_model.pstring)[index]);
		file_str_write(filehandle, ",");
		file_str_write(filehandle, (temp_cena.pstring)[index]);
		file_str_write(filehandle, ",");
		file_str_write(filehandle, (temp_year.pstring)[index]);
		file_str_write(filehandle, ",");
		file_str_write(filehandle, (temp_pro.pstring)[index]);
		file_str_write(filehandle, ",");
	}
	save_enabled = 0; // disable saving until new changes are made to the database
	file_close(filehandle);
}

function add_product()
{
	inkey_active=0;
	str_cpy(art_str, "                    ");
	set (art_txt, VISIBLE);
	inkey(art_str); // read the code of product
	//str_cat(art_str,"                            ");
	str_cpy((temp_art.pstring)[number_of_str], art_str);
	
	str_cpy(naim_str, "                    ");
	set (naim_txt, VISIBLE);
	inkey(naim_str); // read the author
	//str_cat(naim_str,"                            ");
	str_cpy((temp_naim.pstring)[number_of_str], naim_str);
	
	str_cpy(model_str, "                    ");
	set (model_txt, VISIBLE);
	inkey(model_str); // read the author
	//str_cat(model_str,"                            ");
	str_cpy((temp_model.pstring)[number_of_str], model_str);
	
	str_cpy(cena_str, "                    ");
	set (cena_txt, VISIBLE);
	inkey(cena_str); // read the author
	//str_cat(cena_str,"                            ");
	str_cpy((temp_cena.pstring)[number_of_str], cena_str);
	
	str_cpy(year_str, "                    ");
	set (year_txt, VISIBLE);
	inkey(year_str); // read the author
	//str_cat(year_str,"                            ");
	str_cpy((temp_year.pstring)[number_of_str], year_str);
	
	str_cpy(pro_str, "                    ");
	set (pro_txt, VISIBLE);
	inkey(pro_str); // read the author
	//str_cat(pro_str,"                            ");
	str_cpy((temp_pro.pstring)[number_of_str], pro_str);	
	
	my_tov[index].art = art_str; // copy the information from the strings to the struct
	my_tov[index].naim = naim_str;
	my_tov[index].model = model_str;
	my_tov[index].cena = cena_str;
	my_tov[index].year = year_str;
	my_tov[index].pro = pro_str;
	number_of_str += 1; // increment number_of_strings
save_data();
}

void main()
{
	video_set(640,480,32,0);
	mouse_mode=4;
	mouse_map=cursor;
	level_load("");
	wait(1);
	vec_set(sky_color,vector(0,0,0));
	index = -1;
			var filehandle;
		filehandle = file_open_read("strings1.txt"); // try to open the file
		if (filehandle) // the file exists?
		{
				number_of_str = file_var_read(filehandle); // then read number_of_str
				file_close(filehandle); // close the file
				if (number_of_books > 0) // we've got some products in the database?
				{
						filehandle = file_open_read("Tovar.txt"); // then open the file
						if (filehandle) // the file exists?
						{
								while (index < (number_of_str - 1)) // go through all the records and store the data that was read in the strings
								{
										index += 1;
								      file_str_readto(filehandle, (temp_art.pstring)[index], ",", 50); // use , as a separator, read up to 50 characters
										my_tov[index].art = (temp_art.pstring)[index];
								      file_str_readto(filehandle, (temp_naim.pstring)[index], ",", 50); // use , as a separator, read up to 50 characters
										my_tov[index].naim = (temp_naim.pstring)[index];
								      file_str_readto(filehandle, (temp_model.pstring)[index], ",", 50); // use , as a separator, read up to 50 characters
										my_tov[index].model = (temp_model.pstring)[index];
								      file_str_readto(filehandle, (temp_cena.pstring)[index], ",", 50); // use , as a separator, read up to 50 characters
										my_tov[index].cena = (temp_cena.pstring)[index];
										file_str_readto(filehandle, (temp_year.pstring)[index], ",", 50); // use , as a separator, read up to 50 characters
										my_tov[index].year = (temp_year.pstring)[index];
										file_str_readto(filehandle, (temp_pro.pstring)[index], ",", 50); // use , as a separator, read up to 50 characters
										my_tov[index].pro = (temp_pro.pstring)[index];
								}
						}
				}
		}
		else // strings1.txt doesn't exist
		{
				number_of_books = 0;
		}
		add_product();
		
}