000000000000000 when writing to a file/stdout

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

000000000000000 when writing to a file/stdout

Martin Bähr
hi,

i am trying to run pike as a daemon with stdout redirected:

void main(int argc, array argv)
{
  if (sizeof(argv)<2 || argv[1] != "daemon")
  {
     int i = 100;
     while(i--)
     {
         write(i+"\n");
         sleep(0.1);
     }
  }
  else
  {
      Stdio.File newout = Stdio.File("foo", "wc");
      Process.spawn_pike(({ "daemon.pike" }), ([ "stdout":newout ]));
  }
}

this works, but when the program is done, the file is appended with 381018 bytes worth of:
000000000000000000000000000000000000000000000000000000000000000000000000000 ^H0000000000000000000000

it is always the same amount, and i can't tell what causes this...

greetings, martin.
--
cooperative communication with sTeam      -     caudium, pike, roxen and unix
services:   debugging, programming, training, linux sysadmin, web development
--
pike programmer      working in china                   community.gotpike.org
foresight developer  (open-steam|caudium).org              foresightlinux.org
unix sysadmin        iaeste.at                                     realss.com
Martin Bähr          http://www.iaeste.at/~mbaehr/               is.schon.org

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: 000000000000000 when writing to a file/stdout

Martin Bähr
On Thu, Nov 17, 2011 at 08:11:16AM +0100, Martin Bähr wrote:
> this works, but when the program is done, the file is appended with 381018 bytes worth of:
> 000000000000000000000000000000000000000000000000000000000000000000000000000 ^H0000000000000000000000
>
> it is always the same amount, and i can't tell what causes this...

there must be something system dependent going on though, because now
the problem is gone, without a change of the code.

i have seen this symptom before when dealing with stdio.
i wonder what is going on here...

greetings, martin.
--
cooperative communication with sTeam      -     caudium, pike, roxen and unix
services:   debugging, programming, training, linux sysadmin, web development
--
pike programmer      working in china                   community.gotpike.org
foresight developer  (open-steam|caudium).org              foresightlinux.org
unix sysadmin        iaeste.at                                     realss.com
Martin Bähr          http://www.iaeste.at/~mbaehr/               is.schon.org

Loading...