Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!haven!decuac!shlump.nac.dec.com!mountn.dec.com!mosaic.dec.com!m_belanger
From: m_belanger@mosaic.dec.com
Newsgroups: comp.lang.c
Subject: Re: A Question..
Message-ID: <631@mountn.dec.com>
Date: 16 Aug 89 18:08:23 GMT
Sender: news@mountn.dec.com
Distribution: na
Organization: Digital Equipment Corporation - LJ02
Lines: 20

In message # <1586@sunset.MATH.UCLA.EDU> Tony writes:

>I seemed to have run into a strange problem in C that I can't quite 
>figure out.

>I'm just trying to convert a time value stored in a long integer 
>in the form 111753 into a more presentable format 11:17:53.

> ... (removed)

>In other words strcpy seems to be working fine but strncpy is doing 
>something bizzare, or is it the way I'm strncpy'ing? 

STRNCPY( d, s, n ) copies EXACTLY n bytes from s to d which doesn't place a
NULL character after the nth byte.  When the STRNCAT routineis called it
appends the concatenated string at the end of the initial line.

Try clearing the string using a MEMSET before creating the next string.

Moe Belanger