[fpc-pascal] updating an old DOS tool using PChar strings

waldo kitty wkitty42 at windstream.net
Wed Feb 19 21:06:45 CET 2014


i have an old DOS tool written in BP7 that i'm needing to fix a couple of 
problems with... the main problem is that it is using an old CStr unit written 
by a Todd Holmes back in 1993... this unit was written to suppliment the reading 
and writing of "C strings" to/from streams and converting "C strings" (aka null 
terminated strings) to/from PASCAL strings...

i started using this unit because i did not understand pointers and PChar all 
that well back then... it was the first thing i attempted to use that worked for 
the task at hand... now i'm needing to switch it to using BP7 native routines so 
that i can add a few capabilities that are sorely missing... the main one being 
to replace (sub)strings within a PChar string... i've looked for a replacestr or 
strreplace or stringreplace function but have not had any success... what i have 
found seems to be targeted at methods and uses quite unnecessary for this plain 
old DOS command line tool... definitely no turbo vision or anything so elaborate...

so... does anyone have a freely usable BP7 compatible routine that will perform 
this (sub)string replacement task with standard BP7 PChar strings?


further clarification: i would like to convert this tool to FPC but, as noted, 
it is a plain old DOS command line tool... IIRC, the DOS FPC requires some sort 
of memory manager to be used but that would seem to be a lot of overkill for 
this simple tool... quite simply, the tool pulls preformatted null terminated 
strings from a proprietary data file and creates an ascii text file with the 
contents... the final result is that this text file is displayed via html so 
certain characters '<', '>', and '&' (at least) need to be replaced with their 
html entities... that's what the stringreplace routine i'm looking for will be 
used for... i just need to get away from the currently used CStr unit and switch 
to using BP7's native PChar routines to be able to do so...

any help is appreciated and thanks for reading this quite possibly rambling post 
emanating from my scrambled brain cells...

-- 
NOTE: No off-list assistance is given without prior approval.
       Please keep mailing list traffic on the list unless
       private contact is specifically requested and granted.



More information about the fpc-pascal mailing list