Re: One String plus another one

From: Evan Harper (oxford_thames@on.aibn.com)
Date: 03/05/03


On Wed, 5 Mar 2003, Marcel [iso-8859-1] Honstraß wrote:

[cut]

> What i want is to join several strings together so that the output is still
> one string.

[cut]

> (GET_OBJ_ARTICLE(obj) == 1) ? "der " +obj->short_description :( \

[cut]

C does not have a concatenation operator for strings. This code will end
up adding the memory addresses of the constant string "der " and the
string obj->short_description, which makes no sense.

Solution: Use one of C's standard library functions like str(n)cat or
sprintf. Or use the definition to return only the article, and add the
description somewhere else.

This is a basic limitation of C, so I suggest you get fully up to speed on
C programming in general before jumping in to coding on Circle. Otherwise
you'll eventually need to rip out and re-do pretty much all of your early
code.

        elh

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/26/03 PDT