для входа в Telegram. Я хочу запросить у пользователя номер телефона, код подтверждения и пароль 2FA.
Однако программа работает бесконечно и никогда не ждет ввода в std::getline. Вот полный фрагмент:
Код: Выделить всё
#include
#include
#include
#include
#include
#include
#include
#include
#include "td/telegram/td_json_client.h"
using json = nlohmann::json;
struct Credentials {
static constexpr int64_t API_ID = 38753935;
static constexpr const char* API_HASH = "4b80a6b40a8b2fd3396f7e8599d7ef16";
};
enum class AuthState {
WaitTdlibParameters,
WaitPhoneNumber,
WaitCode,
WaitPassword,
Ready,
Closed
};
class TelegramClient {
private:
void* client_;
AuthState current_state_ = AuthState::WaitTdlibParameters;
std::atomic input_pending_{false};
void cleanup_tdl_db(const std::string& db_dir) {
std::filesystem::path db_path(db_dir);
if (std::filesystem::exists(db_path)) {
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79838563/c-tdlib-client-loops-without-stopping-for-stdgetline-when-waiting-for-phone[/url]
Мобильная версия