// This script demonstrates the conversion of a buffer // containing an IP-address as an ASCII-String // into an Long variable. This long variable could be used // whereever an IP-address is necessary // script is for Protocol Developer from V2.0 only // necessary script revision is 22 ScriptName "example ASCII_IP Conversion" ScriptAuthor " FP/da " ScriptVersion "V 1.0" Var vb_ASCII_IP : BUFFER [20]; var vl_IP: long; // the buffer contains a valid IP-address as a string terminated // by a zero (equivalent to langugage C where strings are // always terminated by zero) MoveConst ( vb_ASCII_IP[0], "127.0.0.1"#0 ); // now we convert this string to a long variable Convert( vb_ASCII_IP[0], ASCII_IP, vl_IP, long); // after conversion IP has following value // IP = 0x7F000001, // so every number from the IP Address is one byte of the long variable // now we change it into an invalid address // 300 is not valid at first position MoveConst ( vb_ASCII_IP[0], "300.0.0.1"#0 ); // now we try to convert Convert (vb_ASCII_IP[0], ASCII_IP, vl_IP, long); // last command should give an result code different to 0 // because conversion was not OK