سلام.
من یه برنامه نوشتم که ssh کنه به روتر میکروتیک و آپتایم رو بخونه، حالا میخوام که تحت هر شرایطی که ssh موفقیتآمیز نبود از یوزر بپرسه که یه ورودی بده و دوباره اونکارو انجام بده.
راهی سر راست از goto به ذهنم نرسید.
و اینکه گرفت ورودی از کاربر هم معضلی شده برای من.
این کدمه.
ممنون میشم تجربههاتون رو به اشتراک بذارین با بنده.
Program Project1;
{$APPTYPE CONSOLE}
{$R *.res}
Uses
System.SysUtils,
System.StrUtils;
Var
userInput: Char;
str: String;
Label
again, getOut;
Begin
again:
userInput := '0';
Write('Please Choose:'#10#13'c|C Continue'#10#13'a|A Abort'#10#13's|S Shut The Alert Down'#10#13'You''r Choise: ');
Read(userInput);
Case UpCase(userInput) Of
'C':
Begin
Writeln('You chosed:', userInput);
Goto getOut;
End;
'A':
Begin
Writeln('You chosed:', userInput);
Goto getOut;
End;
'S':
Begin
Writeln('You chosed:', userInput);
Goto getOut;
End
Else
Begin
Writeln('Wrong Option: "', userInput, '"');
Goto again;
End;
End;
getOut:
Writeln('outside');
readln;
Readln;
End.