On Wed, 29 Oct 1997, Tom Whiting wrote: %gcc -c -g -O -Wall -fno-strict-prototypes act.informative.c %act.informative.c: In function `do_toggle': %act.informative.c:1600: called object is not a function %act.informative.c:1610: warning: too few arguments for format The "called object is not a function" usually happens when you refer to an element in a table using paranthesis instead of brackets. That is, instead of the proper 'name[2]' you do 'name(2)'. The latter is the syntax for passing arguments to a function or a macro, not to index an array (the former, using the brackets). As for the "too few arguments for format", this is (most likely) a sprintf() call. sprintf() expects a certain number (and type) of arguments in accordance to the given format. sprintf(buf, "This is the format string. One integer expected %d."); will generate the "too few arguments for format" error because it expects one integer (in general, all things preceeded by a percent sign are format codes; any and all books on C will tell you how to use printf()/sprintf()/fprintf(), so I would suggest looking there for more specifics). To fix this error (warning, actually, because it is non-fatal, and while the code will run fine; it probably won't have the intended result) you simply need to locate which variable is not being passed to sprintf() and add it into the appropriate place in the sprintf() statement. This may seem easy to some, but it can be complicated. The easiest case is (as in our example above) where you just forgot the last [and in this case, the first] argument. If our variable was 'i' (and it was as an 'int') we would do: sprintf(buf, "This is the format string. One integer expected %d.", i); and the error would disappear. Additionally, the value of i would be inserted in the place of '%d'. I grow tired of saying, "CircleMUD isn't a tool for learning C." It isn't neccessarily true, so why should I bother? Whatever it takes to help you learn, can be considered a tool to help you learn. But I will say, and I doubt I will ever say anything to the contrary, that the CircleMUD mailing list is not a tool to aid you in learning C. If you insist on learning C using CircleMUD, then do it on your own, or with the help of a book, or with questions asked on appropriate newsgroups. BTW, when I say, 'you', I don't exclusively mean the person to whom I am responding. Though it is poor style, and rather ambiguous, by 'you' I mean--more or less--all of the newbies whom have asked basic C questions on the list; or those whom are contemplating doing so. -- Daniel Anton Koepke -:- dkoepke@california.com -:- [Nether] "Human language is a cracked kettle on which we beat out tunes for bears to dance to when all the while we want to move the stars to pity." -- Flaubert +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/08/00 PST