?
Solved

how to declare fix size string variable

Posted on 2006-11-14
11
Medium Priority
?
829 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
9 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

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ā€¦
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
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 use and create new code templates in NetBeans IDE 8.0 for Windows.
Suggested Courses

862 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