goesflavio
5th April 2006, 16:03
Hi every body,
I need to test a based variable in the first time without increment it, for exemple:
string array(1,1) based
if "array" then
do something
endif
TKS
NPRao
5th April 2006, 22:10
You cannot use it that way. You will get a fatal error -
1 : process 17 - Fatal error : Zero pointer: name 'main.temp' in get_sval
2 : process 17 - Fatal error : Can not continue in ozmadmtest (main)[isspace]
3 : process 17 - Fatal error : Use of NULL pointer on ''
4 : process 17 - Fatal error : Can not continue in ozmadmtest (main)[isspace]
Here is the same code -
function main()
{
string temp(1) based
if isspace(temp) then
message("Allocated/Empty String Variable")
else
message("Unallocated String Variable")
endif
}
You have to allocate member to the variable before you use it, with the following statement -
e = alloc.mem(temp, 1) and make sure you use free.mem(temp) to release the memory at the end of the program.