DOS's GetEnv returned string length problem 
Author Message
 DOS's GetEnv returned string length problem

'Lo all.

I'm trying to get a filename from the path under OS/2, but have found
that the DOS GetEnv function will only return a string (256 characters).
This isn't good enough, as the path where my editor resides is at
position 258 of my path string. {sigh} Thanks, Murphy.

Under DOS (DOS window of OS/2), using BP 7.0, this is fine, as my PATH
string is only about 30 characters long.

I realize that I'll be {IFDEF}'ing the code, and that there's likely no
way around DOS's 16-bit limitations (although, being able to return the
entire PATH string under DOS, no matter how long, would be an added
benefeit).

Does anyone have code to search for a filename in the path for Virtual
Pascal/2 v1.10?

Thanks in advance!

--

= Stewart Honsberger (AKA Blackdeath)
= Web: http://www.*-*-*.com/ : 3484915
= Remove 'thir{*filter*}' to reply privately

... We need more unemployed politicians.
-!- GOPGP/2 v1.21



Wed, 18 Jun 1902 08:00:00 GMT  
 DOS's GetEnv returned string length problem

Quote:

> I'm trying to get a filename from the path under OS/2, but have found
> that the DOS GetEnv function will only return a string (256 characters).
> This isn't good enough, as the path where my editor resides is at
> position 258 of my path string. {sigh} Thanks, Murphy.

I'm slightly confused about this one; what PATH are you talking about,
the DOS path or the OS/2 path? OS/2 (as far as I can recall) holds them
separately. (I use OS/2 all the time here but also use the 4OS2 and 4DOS
command processors which affects the situation somewhat)

Quote:
> Does anyone have code to search for a filename in the path for Virtual
> Pascal/2 v1.10?

Since VP has ported the BP RTL over -very- accurately, the code for VP
would be exactly the same as for the BP FSearch() help example.

Mike{*filter*}son, Black Cat Software Factory, Edinburgh, Scotland
fax 0131-271-1551 - Columnated Ruins Domino - Mellotron M400 #996



Wed, 18 Jun 1902 08:00:00 GMT  
 DOS's GetEnv returned string length problem


Quote:

>I'm trying to get a filename from the path under OS/2, but have found
>that the DOS GetEnv function will only return a string (256 characters).
>This isn't good enough, as the path where my editor resides is at
>position 258 of my path string. {sigh} Thanks, Murphy.

>Under DOS (DOS window of OS/2), using BP 7.0, this is fine, as my PATH
>string is only about 30 characters long.

>I realize that I'll be {IFDEF}'ing the code, and that there's likely no
>way around DOS's 16-bit limitations (although, being able to return the
>entire PATH string under DOS, no matter how long, would be an added
>benefeit).

>Does anyone have code to search for a filename in the path for Virtual
>Pascal/2 v1.10?

>Thanks in advance!

>--

DSS.

There is old TP code to locate, access and change an environment in
        http://www.merlyn.demon.co.uk/programs/path-fix.pas
and your problem is largely a subset of that.

The actual search is trivial, since efficiency cannot be critical.

I don't know VP, but the algorithm should be translatable if VP can
access the PSP.

--

  Web <URL: http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
  PAS, EXE in <URL: http://www.merlyn.demon.co.uk/programs/> - see 00index.txt.
  Do not Mail News to me.    Before a reply, quote with ">" or "> " (SoRFC1036)



Wed, 18 Jun 1902 08:00:00 GMT  
 DOS's GetEnv returned string length problem

comp.lang.pascal.borland:

Quote:
>> I'm trying to get a filename from the path under OS/2, but have found
>> that the DOS GetEnv function will only return a string (256 characters).
>> This isn't good enough, as the path where my editor resides is at
>> position 258 of my path string. {sigh} Thanks, Murphy.

>I'm slightly confused about this one; what PATH are you talking about,
>the DOS path or the OS/2 path?

My OS/2 path, which is about 500+ characters long at the moment.

Quote:
>> Does anyone have code to search for a filename in the path for Virtual
>> Pascal/2 v1.10?

>Since VP has ported the BP RTL over -very- accurately, the code for VP
>would be exactly the same as for the BP FSearch() help example.

Yes, but it only accepts a string as a parameter - again, the 256
character limitation.

Is there a 32-bit FSearch function? One that accepts a PChar? I could
hunt around through the RTL source code and modify the FSearch function
for this purpose, but would prefer not to re-invent the wheel.

--

= Stewart Honsberger (AKA Blackdeath)
= Web: http://www.*-*-*.com/ : 3484915
= Remove 'thir{*filter*}' to reply privately

... I believe in a God that doesn't require heavy financing.
-!- GOPGP/2 v1.21



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. DOS's GetEnv returned string length problem

2. Sql error - Field can't contained a string of length null

3. GetEnv('COMSPEC') under NT

4. 'Field cannot be zero length' error

5. Null-length strings in MSAccess

6. Beginners question....length of string.

7. Variable length strings to DLLs

8. Fixed length strings....

9. strings and arrays of undetermined length

10. how to use strings/arrays of variable length?

11. Undependent from string field length

12. Sending any length string to a procedure, OpenString

 

 
Powered by phpBB® Forum Software