Re: Notification System Woes
Re: Notification System Woes
- Subject: Re: Notification System Woes
- From: Ed Watkeys <email@hidden>
- Date: Wed, 3 Dec 2003 02:08:24 -0500
On Dec 3, 2003, at 12:15 AM, Saul Iversen wrote:
Needless to say, I'd rather be receiving notifications much more
frequently so that I could keep refreshing the temperature display in
real time. My question then is how can I work around this issue? Can I
somehow set a smaller "buffer full" size so that the notification comes
after just a few bytes? Or should I be using an entirely different
approach? Your patience and support are sincerely appreciated.
Saul,
Does the program you're invoking in the NSTask use buffered file I/O?
If it does, then reading in smaller chunks isn't going to help. If
you've written the /Users/Me/MyPath/Temperature program, and you're
using C standard file I/O for writing to stdout, you can use the
following function in your program:
setbuf(FILE * restrict stream, char * restrict buf);
For example:
setbuf(stdout, NULL);
If your program is written in Perl, Python, or some other language,
there should be a way to turn off buffering on stdout. I have no idea
what's going inside your /Users/Me/MyPath/Temperature program, but the
buffering may be happening at a deeper level than stdout; your library
for reading data from whatever source you're retrieving information
from may buffer the data source's output, or your data source may be
buffering its output.
Stdout is line buffered by default when attached to a terminal, so if
your program produces data in a way acceptable to you when run from the
command line, then it's likely that using the above setbuf function
will solve your problem.
Regards,
Ed
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.