Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!munnari.oz.au!mel.dit.csiro.au!yarra!pta!teti!teslab!andrew From: andrew@teslab.lab.OZ (Andrew Phillips) Newsgroups: comp.sys.amiga.programmer Subject: Re: C string library? Message-ID: <1206@teslab.lab.OZ> Date: 20 Feb 91 06:41:23 GMT References: <874@cbmger.UUCP> Reply-To: andrew@teslab.lab.oz.au (Andrew Phillips) Organization: Technology Evaluation Section, L.A.B., Sydney Lines: 31 In <874@cbmger.UUCP> by peterk@cbmger.UUCP (Peter Kittel) writes: > [Idea to (re?)write C string routines to look like BASIC ones] You couldn't rewrite the standard string routines (strcpy, strcat etc) to work like the BASIC ones but you could write a new set of routines to do exactly what BASIC does (I think I heard of someone doing that a long time ago). Actually you would be much better off using C++. Then you could use your own string type in code like: str a, b, c; a = "Name: "; -- assign C string to "str" type putstr(a); -- output of str b = getstr(); -- input of str c = a + b; -- concatenation of str by having a string type which would be a sort of pointer to a real string and overloading operators "+", "=" etc. Most C programmers prefer the standard C string routines because they know what they are doing exactly internally whereas the BASIC ones are a bit unknown/unpredictable, especially when they decide to do a bit of garbage collection. I have a whole lot of string routines that I wrote that make using normal C strings a lot easier. If anybody is interested in them I could get them posted to c.s.a. Andrew. -- Andrew Phillips (andrew@teslab.lab.oz.au) Phone +61 (Aust) 2 (Sydney) 289 8712