Solved

how to declare fix size string variable

Posted on 2006-11-14
11
818 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Anomalies in ASP.NET ConnectionStrings 4 101
eclipse error 7 112
Eclipse versons - run configurations 2 86
Recommendation vb6 to vb.net or others 14 240
Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand columnThat will then direct you to their download page.From that page s…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses

732 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