Re: String too long
Posted in 1998
June Tong wrote: > > Goran Domazet wrote: > > > We started to compile our applications with -anyerr flag (on I4GL > > 4.13, C compiler version). > > Now the following code quits program with -4401 error (string too long > > to fit): > > > > main > > define a,b char(3) > > let a = " " clipped > > let b = "xxx",a > > end main > > > > Why does it happen? > > Because your string is too long. A is 3 characters. B is 3 characters. > "xxx" is 3 characters. When you assign " " clipped to A, it gets padded > with blanks, out to 3 characters. CHAR variables are always padded to > their defined length. You can't add a 3-character string to another > 3-character string and assign the result to a 3-character string. (Well, > you can, but you did say -anyerr.) > > June > -- > june_t@hotmail.com > Grounded in Palo Alto, living on Oreo's As an illustration, this *would* work: let a = " " clipped -- a is still exactly the same after clipping and storage, 3 chars let b = "xxx",a clipped -- b is now just "xxx" as a clipped is a zero-length string -- zero-length strings exist only during expression evaluation, it seems -- Peter Lancashire Information Systems Specialist, Bayer plc Eastern Way, Bury St Edmunds, Suffolk, IP32 7AH, UK Tel: +44-1635-562258, Fax: +44-1635-562281 -- If all else fails, read the instructions and the release notes. Join Infuse, the UK Informix User Group at http://www.infuse.org.uk/