Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

converting ansistring to int

  • 15-04-2003 8:39pm
    #1
    Registered Users, Registered Users 2 Posts: 2,591 ✭✭✭


    i have this piece of code to take a value from an inputbox then convert it to an int then assign to a structure but it keeps telling me that i have clled an undefined function even thoughj i have included the vcl\dstring.h header file

    value is declared as an int

    AnsiString InputString = InputBox("Input Box", "Please enter the value for the gate", "0");
    value = ToIntDef(InputString);
    newconnector->Value = value;
    could any one help??

    tanx


Comments

  • Closed Accounts Posts: 3,322 ✭✭✭Repli


    try
    int value = ToIntDef(InputString);


  • Registered Users, Registered Users 2 Posts: 2,591 ✭✭✭tommycahir


    sorry repli still getting the same error
    tanx for trying


  • Closed Accounts Posts: 3,322 ✭✭✭Repli


    Hmm k.. Try
    int value = InputString.ToIntDef(-1);
    This does the same thing iirc except if it tries to convert a string to an int it will return -1


  • Registered Users, Registered Users 2 Posts: 6,240 ✭✭✭hussey


    int convert_ansi_int(AnsiString str) 
    {
    
    return atoi(str.c_str());
    
    }
    
    // this is equililebt of this (  I think)
    int convert_ansi_int(AnsiString str) 
    {
    
    char * tempStr = str.c_str();
    int num = atoi(tempStr);
    return num;
    
    }
    


Advertisement