예제 #1
0
파일: main.c 프로젝트: NikolovV/C-Language
int main()
{
    char text[TEXT_SIZE];
    fgets(text, TEXT_SIZE, stdin);
    size_t textLenght = remove_new_line(text);

    int lineLenght;
    scanf("%3d%*c", &lineLenght);
    float rows = textLenght / ((float) lineLenght);
    int rowLenght = (int) rows + 1;

    char bomb[COLUMN_BOMB];
    fgets(bomb, TEXT_SIZE, stdin);
    remove_new_line(bomb);

    char **field = NULL;
    alloc_2D_arr_memory(&field, rowLenght, lineLenght);

    copy_to_2D_array(rowLenght, lineLenght, field, text, textLenght);

    start_mission(rowLenght, lineLenght, field, bomb);

    print_the_field(rowLenght, lineLenght, field, textLenght);

    free_2D_memory((void **) field, rowLenght);

    return (EXIT_SUCCESS);
}
예제 #2
0
static int pack_gestion(char c, int sockfd)
{
	if (c == RS)
	{
		ft_recv_file(sockfd);
		return (1);
	}
	if (c == RFD)
	{
		delete_mission(sockfd);
		return (1);
	}
	if (c == ACP)
	{
		start_mission(sockfd);
		return (1);
	}
	return (0);
}