divyeshhdoshi
asked on
how to declare fix size string variable
i want to declare string variable of 128 char size...
how can i declare that ...
in VB i think
Dim Buffer As String * 128 is working.. good .
but what abt PB...
how can i declare that ...
in VB i think
Dim Buffer As String * 128 is working.. good .
but what abt PB...
Hi,
what gajender said is not the exactly you want...it is array declaration in PB.
As per my knowledge, fixed size variable declaration is not possible in PB.
I think you want this to call some windows API if that is the case then in powerbuilder when you pass any string variable as reference to any external api call that time should assign memory space to that variable in advance for that you can assign space of that much length to that variable.
for example.
there is windows api getcomputername(string compname)
where, compname is string variable and passed as reference, so according to api defination you should assign value to that variable before you pass to api call.
like...
string compname = space(128)
getcomputername(compname)
Hope, this will work for you.
Regards,
Sandeep
what gajender said is not the exactly you want...it is array declaration in PB.
As per my knowledge, fixed size variable declaration is not possible in PB.
I think you want this to call some windows API if that is the case then in powerbuilder when you pass any string variable as reference to any external api call that time should assign memory space to that variable in advance for that you can assign space of that much length to that variable.
for example.
there is windows api getcomputername(string compname)
where, compname is string variable and passed as reference, so according to api defination you should assign value to that variable before you pass to api call.
like...
string compname = space(128)
getcomputername(compname)
Hope, this will work for you.
Regards,
Sandeep
ASKER
i think space(128) is working properly...
because when we pass that string to another api function that doesn't know that variable size is 128 chars. so that function place all chars in that variable..
finally .......
we got solution by another way....
thanks for giving hint....
Sandeepbhai mazaman choone....... FROM TMSPL Ahemdabad.
because when we pass that string to another api function that doesn't know that variable size is 128 chars. so that function place all chars in that variable..
finally .......
we got solution by another way....
thanks for giving hint....
Sandeepbhai mazaman choone....... FROM TMSPL Ahemdabad.
ASKER
my previous comment is wrong
think space(128) is not working properly...
because when we pass that string to another api function that doesn't know that variable size is 128 chars. so that function place all chars in that variable..
finally .......
we got solution by another way....
thanks for giving hint....
Sandeepbhai mazaman choone....... FROM TMSPL Ahemdabad.
think space(128) is not working properly...
because when we pass that string to another api function that doesn't know that variable size is 128 chars. so that function place all chars in that variable..
finally .......
we got solution by another way....
thanks for giving hint....
Sandeepbhai mazaman choone....... FROM TMSPL Ahemdabad.
Hi,
i am doing good...
let me how u found the solution and what was the exact problem ?
Regards,
Sandeep
i am doing good...
let me how u found the solution and what was the exact problem ?
Regards,
Sandeep
ASKER
hi ,
i can't tell u solution....
sorry..
i can't tell u solution....
sorry..
Hi,
It's ok...But I am quite disappointed. Because here everyone is sharing their knowledge not code.
Anyway it's your choice.... Keep on posting your problems....
Regards,
Sandeep
It's ok...But I am quite disappointed. Because here everyone is sharing their knowledge not code.
Anyway it's your choice.... Keep on posting your problems....
Regards,
Sandeep
ASKER
hi,
we pass single line edit control and place our fixed size in limit property of sle.....
Regards,
Divyesh Doshi.
we pass single line edit control and place our fixed size in limit property of sle.....
Regards,
Divyesh Doshi.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Gajender