> 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