Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: safe strcpy()?

From: Timo Sirainen <tss(at)iki.fi>
Date: Wed Jan 29 2003 - 20:47:04 EST

On Thu, 2003-01-30 at 01:40, Ben Pfaff wrote:
> As a result, strncpy() is hardly ever the right function to use.

I don't understand the point of strlcpy() and strlcat() return value though. Can it really be used for anything else than checking if the value was truncated? Why not simply return -1 when it is?

if (strocpy(dest, src, sizeof(dest)) < 0) { ... }

vs.

if (strlcpy(dest, src, sizeof(dest)) >= sizeof(dest)) { ... }

Even worse if the size parameter is anything more complicated. Received on Thu Jan 30 12:29:08 2003

This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 14:02:46 EDT

Do you need help?X

Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library