Solved

how to declare fix size string variable

Posted on 2006-11-14
11
802 Views
Last Modified: 2013-12-26
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...



0
Comment
Question by:divyeshhdoshi
  • 4
  • 4
11 Comments
 
LVL 8

Expert Comment

by:gajender_99
ID: 17938776
string  vls_test[128]


Gajender
0
 
LVL 14

Expert Comment

by:sandeep_patel
ID: 17953611
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
0
 
LVL 6

Author Comment

by:divyeshhdoshi
ID: 17953791
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.
0
 
LVL 6

Author Comment

by:divyeshhdoshi
ID: 17953804
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.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 14

Expert Comment

by:sandeep_patel
ID: 17954027
Hi,

i am doing good...
let me how u found the solution and what was the exact problem ?

Regards,
Sandeep
0
 
LVL 6

Author Comment

by:divyeshhdoshi
ID: 18066606
hi ,

i can't tell u solution....

sorry..



0
 
LVL 14

Expert Comment

by:sandeep_patel
ID: 18067051
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
0
 
LVL 6

Author Comment

by:divyeshhdoshi
ID: 18201257
hi,

we pass single line edit control and place our fixed size in limit property of sle.....

Regards,
Divyesh Doshi.
0
 
LVL 14

Accepted Solution

by:
sandeep_patel earned 20 total points
ID: 18201628
Hi,

I think you are doing the same what I said earlier. Bcoz in your API you are not passing single line edit control you are passing the value in that means....

function_name(edit_control_name.text)
NOT
function_name(edit_control_name)

It means you are passing string of some characters ( or spaces) of defined lengths (specified as in limit property). And what I told earlier is to pass the variable directly of that many characters ( or spaces)

For eg.
your edit control has limit of 1000. Then in your function you pass

string ls_test
ls_test = space(1000)
function_name(ls_test)

It must work according to my knowledge.......

Regards,
Sandeep
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now