Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how to declare fix size string variable

Posted on 2006-11-14
11
Medium Priority
?
828 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
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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

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: …
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 and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

618 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