Example #1
0
void	sigwinch_handler(t_data *data)
{
	ioctl(0, TIOCGWINSZ, &(data->win));
	data = stock_data(data, 1);
	tputs(tgetstr("cd", NULL), tgetnum("co"), ft_putchar2);
	show_menu(data);
}
void Lesson3::DoWork()
{
	std::ifstream inputStream(BINARY_DIR "/input.txt", std::ios::binary);
	if (!inputStream.good())
	{
		std::cout << "Incorrect file path: " << BINARY_DIR "/input.txt" << std::endl;
		return;
	}

	while (true)
	{
		binary_reader::stock_data stock_data(inputStream);

		if(inputStream.eof())
			break;

		const std::string file_name = BINARY_DIR + std::string("/output_") + std::string(stock_data.stock_name()) + std::string(".txt");
		const char* stock_name = stock_data.stock_name();

		if(stock_collection1.find(stock_name) == stock_collection1.end())
			stock_collection1[stock_name] = boost::make_shared<std::ofstream>(file_name, std::ios::out | std::ios::binary);

		stock_data.write(*stock_collection1[stock_name]);
	}
	inputStream.close();

	Close(stock_collection1);
}
Example #3
0
void	signal_handler(int signum)
{
	t_data *data;

	data = NULL;
	data = stock_data(data, 0);
	if(signum == SIGINT)
		sigint_handler(data);
	if(signum == SIGTSTP)
		sigtstp_handler(data);
	if(signum == SIGWINCH)
		sigwinch_handler(data);
	if(signum == SIGCONT)
		sigcont_handler(data);
}