Solved

where is wrong? help!

Posted on 2001-08-03
9
266 Views
Last Modified: 2008-03-06

AnsiString secret=InputBox("Veri.","password","Default");

if (Session->AddPassword(secret)==false)
  {ShowMessage("Can not open the file");
   Application->Terminate();}
  else{
  return;//continue
);
0
Comment
Question by:Johncili
9 Comments
 
LVL 3

Expert Comment

by:kulina
ID: 6349165
AnsiString secret=InputBox("Veri.","password","Default");

if (Session->AddPassword(secret)==false)
 {ShowMessage("Can not open the file");
  Application->Terminate();}
 else{
 return;//continue
);  <- change ');' to '}' (without quotes of course)

Rgds.

0
 
LVL 2

Expert Comment

by:smitty1276
ID: 6349439
What error are you getting?
0
 

Author Comment

by:Johncili
ID: 6349583
AnsiString secret=InputBox("Veri.","password","Default");

if (Session->AddPassword(secret)==false)  <<======= ???
{ShowMessage("Can not open the file");
 Application->Terminate();}
else{
return;//continue
}

Can not run. See where ??? shows.
0
ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
LVL 6

Expert Comment

by:Triskelion
ID: 6349616
Please compile this in DEBUG mode and trace through the steps.

When the program fails, copy the error message and paste it here.

If the program will not compile, please copy the error message you get from the compiler and paste it here so we can see it.
0
 

Author Comment

by:Johncili
ID: 6349788
     Char *buf1 = "aaa", *buf2;int ptr;
      buf2=InputBox("Veri.","password","Default");
      ptr = strcmp(buf2, buf1);
         if (ptr >0 || ptr <0)
           {ShowMessage("Wrong! ");
            Application->Terminate();}
         else {};

  buf2=InputBox("Veri.","password","Default"); ????
0
 

Author Comment

by:Johncili
ID: 6349793
C++ Error: Cannot convert 'AnsiString' to'char*'??

How to modify?
0
 
LVL 6

Expert Comment

by:Triskelion
ID: 6349851
I'm not familiar with AnsiString.
Try
Session->AddPassword((char *)secret)
0
 
LVL 8

Accepted Solution

by:
mnashadka earned 100 total points
ID: 6350458
Use Session->AddPassword(secret.c_str());
0
 
LVL 3

Expert Comment

by:null_pointer
ID: 6354125
To convert the string to AnsiString you could use the
UnicodeToAnsi  and the
AnsiToUnicode

functions
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question