Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/17/84 chuqui version 1.9 3/12/85; site unisoft.UUCP Path: utzoo!watmath!clyde!bonnie!akgua!gatech!seismo!lll-crg!lll-lcc!unisoft!fnf From: fnf@unisoft.UUCP Newsgroups: net.micro.amiga Subject: sprintf arg lengths limitation Message-ID: <599@unisoft.UUCP> Date: Sun, 24-Nov-85 17:45:55 EST Article-I.D.: unisoft.599 Posted: Sun Nov 24 17:45:55 1985 Date-Received: Mon, 25-Nov-85 08:09:23 EST Distribution: net Organization: UniSoft Systems, Berkeley Lines: 35 /* * This program demonstrates that there is a limitation on how long * a string "sprintf()" is capable of printing. On my machine, it * appears to be 200 characters. I don't know whether this is the * limit on an individual argument, or the total of the argument * lengths, but it would be easy enough to write another test program * to find out. So, beware..., this has already bitten me once. * * Also, note that when the limit is reached, sprintf returns a value * one greater than the actual number of characters placed in the * output buffer. * * Fred Fish */ #include #define MAXSIZE (256) main () { auto char buffer1[MAXSIZE+1]; auto char buffer2[MAXSIZE+1]; register int index; register int xfered; buffer1[0] = 0; buffer2[0] = 0; for (index=0; index < MAXSIZE; index++) { xfered = sprintf (buffer1, "%s%c", buffer2, '0' + (index % 10)); printf ("%3.3d: %s\n", xfered, buffer1); fflush (stdout); strcpy (buffer2, buffer1); } }