From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <5acaebb4de367f34d9d5c152e0e80c16@plan9.bell-labs.com> Date: Thu, 29 Jul 2010 14:12:06 +0200 From: Sape Mullender To: 9fans@9fans.net CC: 9fans@9fans.net In-Reply-To: <0522651bfa90c83ddb192a77ddaccb78@swcp.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] writing to ctl using fprint and write Topicbox-Message-UUID: 44ac52f6-ead6-11e9-9d60-3106f5b1d025 > I'm working on some regression testing for my GSoC project and am trying > to understand why > > ctl = open(path("ctl"),ORDWR|OAPPEND); > ts = "chatty9p 1"; // or some other message > > n = fprint(ctl, ts); > > succeeds, while > > n = write(ctl,ts,sizeof(ts)); > > fails. > > Can someone explain? Obviously, ts is a char* and, therefore, its size is 4. You want strlen(ts) instead of sizeof(ts). Sape