本文整理汇总了C++中Prompt函数的典型用法代码示例。如果您正苦于以下问题:C++ Prompt函数的具体用法?C++ Prompt怎么用?C++ Prompt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Prompt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Reconfigure
void Reconfigure()
{
fflush(stdin);
Prompt("\nDo you want to \n"
" Randomly generate graphs (r),\n"
" Specify a graph (s),\n"
" Randomly generate a maximal planar graph (m), or\n"
" Randomly generate a non-planar graph (n)?");
scanf(" %c", &Mode);
Mode = tolower(Mode);
if (!strchr("rsmn", Mode))
Mode = 's';
if (Mode == 'r')
{
Message("\nNOTE: The directories for the graphs you want must exist.\n\n");
Prompt("Do you want original graphs in directory 'random' (last 10 max)?");
scanf(" %c", &OrigOut);
Prompt("Do you want adj. matrix of embeddable graphs in directory 'embedded' (last 10 max))?");
scanf(" %c", &EmbeddableOut);
Prompt("Do you want adj. matrix of obstructed graphs in directory 'obstructed' (last 10 max)?");
scanf(" %c", &ObstructedOut);
Prompt("Do you want adjacency list format of embeddings in directory 'adjlist' (last 10 max)?");
scanf(" %c", &AdjListsForEmbeddingsOut);
}
FlushConsole(stdout);
}
示例2: delete_lines
static int delete_lines(int nrows, char *rows)
{
char input[4];
int first, last;
DDPut(sd[ledelstr]);
input[0] = 0;
if (!(Prompt(input, 3, PROMPT_NOCRLF)))
return -1;
if ((first = str2uint(input, 1, nrows)) == -1)
return nrows;
DDPut(sd[ledeltostr]);
input[0] = 0;
if (!(Prompt(input, 3, 0)))
return -1;
if ((last = str2uint(input, 1, nrows)) == -1)
return nrows;
if (last < first) {
int tmp;
tmp = last;
last = first;
first = tmp;
}
memmove(rows + (first - 1) * 80, rows + last * 80, (nrows - last) * 80);
return nrows - (last - first + 1);
}
示例3: PromptPlugin
PPlugin PromptPlugin (int Type)
{
char filepath[MAX_PATH];
PPlugin result = (PPlugin)DialogBoxParam(hInst,MAKEINTRESOURCE(IDD_SELECTPLUGIN),topHWnd,DLG_SelectPlugin,(LPARAM)Type);
if (result == NULL)
return NULL;
if (result->num != 9998)
return result;
PromptTitle = "Specify iNES mapper number (cancel for none):\r\n(-1 to skip .NES, 9999 to skip .NES and .UNIF)";
if (Prompt(topHWnd))
custplug.num = atoi(PromptResult);
else custplug.num = -1;
if (custplug.num != 9999)
{
PromptTitle = "Specify UNIF board name (cancel for none):";
if (Prompt(topHWnd))
strcpy(custplug.name,PromptResult);
else if (custplug.num == -1)
custplug.num = 9999;
}
while (1)
{
if (!PromptFile(topHWnd,"USB CopyNES Plugins (*.bin)\0*.bin\0\0\0\0", filepath, custplug.file, Path_PLUG, "Select a plugin (must be in Plugins path)", "bin", FALSE))
return NULL;
if (strnicmp(Path_PLUG, filepath, strlen(Path_PLUG)))
MessageBox(topHWnd,"Selected file is not located in Plugins directory!","Select Plugin", MB_OK | MB_ICONERROR);
else break;
}
return &custplug;
}
示例4: Prompt
bool PasswdBackend::authenticate() {
if (m_autologin)
return true;
if (m_user == "sddm") {
if (m_greeter)
return true;
else
return false;
}
Request r;
QString password;
if (m_user.isEmpty())
r.prompts << Prompt(AuthPrompt::LOGIN_USER, "Login", false);
r.prompts << Prompt(AuthPrompt::LOGIN_PASSWORD, "Password", true);
Request response = m_app->request(r);
Q_FOREACH(const Prompt &p, response.prompts) {
switch (p.type) {
case AuthPrompt::LOGIN_USER:
m_user = p.response;
break;
case AuthPrompt::LOGIN_PASSWORD:
password = p.response;
break;
default:
break;
}
}
struct passwd *pw = getpwnam(qPrintable(m_user));
if (!pw) {
m_app->error(QString("Wrong user/password combination"), Auth::ERROR_AUTHENTICATION);
return false;
}
struct spwd *spw = getspnam(pw->pw_name);
if (!spw) {
qWarning() << "[Passwd] Could get passwd but not shadow";
return false;
}
if(!spw->sp_pwdp || !spw->sp_pwdp[0])
return true;
char *crypted = crypt(qPrintable(password), spw->sp_pwdp);
if (0 == strcmp(crypted, spw->sp_pwdp)) {
return true;
}
m_app->error(QString("Wrong user/password combination"), Auth::ERROR_AUTHENTICATION);
return false;
}
示例5: PromptAbortRetryIgnore
int PromptAbortRetryIgnore(const char *qtf) {
BeepExclamation();
return Prompt(callback(LaunchWebBrowser),
Ctrl::GetAppName(), CtrlImg::exclamation(), qtf, false,
t_("&Abort"), t_("&Retry"), t_("&Ignore"), 0,
AbortButtonImage(), RetryButtonImage(), Null);
}
示例6: PromptAbortRetryIgnore
int PromptAbortRetryIgnore(const char *qtf, Callback HelpDlg, const char *help) {
#ifdef PLATFORM_WIN32
MessageBeep(MB_ICONEXCLAMATION);
#endif
return Prompt(Ctrl::GetAppName(), CtrlImg::exclamation(), qtf, HelpDlg,
false, t_("&Abort"), t_("&Retry"), t_("&Cancel"), help);
}
示例7: start_display_buff
void start_display_buff(char *buff)
{
char buffer[5];
num_members++;
if (moreflg)
return;
if (currow >= LINES - 2)
{
page++;
currow++;
mvcur(0, 0, currow, STARTCOL);
refresh();
if (Prompt("--RETURN for more, ctl-c to exit--", buffer, 1, 0) == 0)
{
erase_line(currow, STARTCOL);
show_text(currow, STARTCOL, "Flushing query...");
moreflg = 1;
return;
}
clrwin(DISPROW + 2);
currow = DISPROW + 2;
show_text(currow, STARTCOL, "continued");
currow++;
}
show_text(currow, STARTCOL, buff);
currow++;
return;
}
示例8: FinishSave
bool FinishSave(String tmpfile, String outfile)
{
if(IsDeactivationSave()) {
FileMove(tmpfile, outfile);
return true;
}
Progress progress;
int time = GetTickCount();
for(;;) {
progress.SetTotal(10000);
progress.SetText("Saving '" + GetFileName(outfile) + "'");
if(!FileExists(tmpfile))
return false;
FileDelete(outfile);
if(FileMove(tmpfile, outfile))
return true;
IdeConsoleFlush();
Sleep(200);
if(progress.SetPosCanceled((GetTickCount() - time) % progress.GetTotal())) {
int art = Prompt(Ctrl::GetAppName(), CtrlImg::exclamation(),
"Unable to save current file.&"
"Retry save, ignore it or save file to another location?",
"Save as...", "Retry", "Ignore");
if(art < 0)
return false;
if(art && AnySourceFs().ExecuteSaveAs())
outfile = AnySourceFs();
progress.SetPos(0);
}
}
}
示例9: PromptYesNoCancel
int PromptYesNoCancel(const char *qtf) {
BeepQuestion();
return Prompt(callback(LaunchWebBrowser),
Ctrl::GetAppName(), CtrlImg::question(), qtf, true,
t_("&Yes"), t_("&No"), t_("Cancel"), 0,
YesButtonImage(), NoButtonImage(), Null);
}
示例10: PromptRetryCancel
int PromptRetryCancel(const char *qtf) {
BeepExclamation();
return Prompt(callback(LaunchWebBrowser),
Ctrl::GetAppName(), CtrlImg::exclamation(), qtf, true,
t_("&Retry"), t_("Cancel"), NULL, 0,
RetryButtonImage(), Null, Null);
}
示例11: Prompt
int Prompt(Callback1<const String&> WhenLink,
const char *title, const Image& icon, const char *qtf, bool okcancel,
const char *button1, const char *button2, const char *button3,
int cx)
{
return Prompt(WhenLink, title, icon, qtf, okcancel, button1, button2, button3, cx, Null, Null, Null);
}
示例12: delete_member
void delete_member(void)
{
char *argv[3];
char *buf;
show_text(DISPROW, STARTCOL, "Remove yourself from a list\n");
buf = calloc(LISTMAX, 1);
if (Prompt("Enter List Name: ", buf, LISTSIZE, 1) == 1)
{
display_buff("\n");
argv[0] = strdup(buf);
argv[1] = strdup("user");
argv[2] = strdup(username);
if ((status = mr_query("delete_member_from_list", 3, argv, NULL, NULL)))
{
display_buff("\n");
com_err(whoami, status, " found.\n");
}
else
{
sprintf(buf, "User %s deleted from list\n", username);
show_text(DISPROW + 3, STARTCOL, buf);
}
currow = DISPROW + 4;
show_text(DISPROW + 4, STARTCOL, "Press any Key to continue...");
getchar();
free(argv[0]);
free(argv[1]);
free(argv[2]);
}
free(buf);
clrwin(DISPROW);
}
示例13: ClearHistory
/**
* clears the buffer history, not the command history
*/
void ClearHistory()
{
fn(ptr, SCI_SETTEXT, 0, (sptr_t)"");
clearLogText();
cmdVector.clear();
Prompt();
}
示例14: GuiPackageResolver
bool GuiPackageResolver(const String& error, const String& path, int line)
{
prompt:
switch(Prompt(Ctrl::GetAppName(), CtrlImg::exclamation(),
error + "&while parsing package " + DeQtf(path),
"Edit \\& Retry", "Ignore", "Stop")) {
case 0:
if(!PromptYesNo("Ignoring will damage package. Everything past the "
"point of error will be lost.&Do you want to continue ?"))
goto prompt;
return false;
case 1: {
TopWindow win;
LineEdit edit;
edit.Set(LoadFile(path));
edit.SetCursor(edit.GetPos(line));
win.Title(path);
win.Add(edit.SizePos());
win.Run();
SaveFile(path, edit.Get());
}
return true;;
case -1:
exit(1);
}
return false;
}
示例15: Exec
int Shell::Run(Client* client, Server* server){
char buf[BUFFER_SIZE];
if(fgets(buf, BUFFER_SIZE, stdin) == NULL)
return SHELL_EXIT;
buf[strlen(buf)-1] = 0;
int res = Exec(buf, client, server);
if(res != SHELL_EXIT)Prompt();
return res;
}