TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Michael Baker
from: Steven Pasztor
date: 1993-10-12 17:51:06
subject: Re: Pascal strings

So to Michael Baker do I speak these words:


Monday October 04 1993 12:00, Michael Baker wrote to Steven Pasztor:


 SP>> Is there any way to get C to work with Pascal style
 SP>> strings? The length byte at the start is very usefull
 SP>> sometimes, and it would be good to be able to choose the
 SP>> most appropriate method for the circumstances. Also,
 SP>> converting back to C would be simple.
 MB> I guess it depends on what you mean by "work with".  The
scheme that
 MB> immediatley comes to my mind is to use a combined approach.  There are
 MB> probably other ways as well.  What I have in mind is this:
 MB>   Have the length byte at the start of the string and a nul byte at the
 MB>   end.
 MB>   Have conversion functions (or macros) so you can use your Pascal-C
 MB>   strings in standard library functions.

I've been thinking along those lines too... Conversion wouldn't really be
neccisary. Give C routines the string starting at the second character, and
pascal routines get the string starting from the first. (size byte) Then
all you have to do is call a routine which recalculates the length byte, or
replaces the nul depending on wether it was altered by a C or Pascal
routine. Then all you've got to do is remember to hand C routines a string
starting at the second character instead of the first. That's where the fun
starts! :-)


nevets


... A wise man never plays leapfrog with a unicorn

--- FMail 0.94

* Origin: HELP!!! (3:632/103.123)
SEEN-BY: 50/99 54/54 99 620/243 622/405 623/630 632/103 301 348 365 386 998
SEEN-BY: 633/371 634/383 384 635/502 503 544 555 570 636/100 670/206 711/401
SEEN-BY: 711/409 430 807 808 809 932 934 712/623 627 713/888 714/906 800/1
@PATH: 632/103 348 635/503 50/99 54/54 99 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.