Re: strcat strncat and strlen
- From: gordonb.j3awa@xxxxxxxxxxx (Gordon Burditt)
- Date: Mon, 31 Mar 2008 02:28:52 -0000
Why in production code would someone want to know the length of a
string?
Why would you want to check input for validity? In the case of strings,
that often includes minimum and maximum length constraints.
Why would you want to check if the next word (in a fixed-width font) will
fit on the current line, or whether you must start a new one?
Why would you want to check if there is going to be a buffer overflow
before overflowing it? This is often related to putting the data
input into a database (C does not define the term 'database' but you
can build one using files).
Why would you want to center a title on a page, in a fixed-width
font? (Take the width of the page in characters, subtract the
length of the title, divide by 2, round, and print that many spaces,
then the message, then start a new line).
.
- References:
- strcat strncat and strlen
- From: Bill Cunningham
- Re: strcat strncat and strlen
- From: santosh
- Re: strcat strncat and strlen
- From: Bill Cunningham
- strcat strncat and strlen
- Prev by Date: Re: Reentrant functions and memory allocation
- Next by Date: Re: Strange bit shifting result with gcc - am I missing something obvious?
- Previous by thread: Re: strcat strncat and strlen
- Next by thread: Re: strcat strncat and strlen
- Index(es):
Relevant Pages
|