hi Adrian Chadd
Thanks for your reply
when i execute file from terminal
./first
its working perfect
when i am executing from the Squid its writing nothing into a txt file
i am attaching squid.conf file for your reference.
waiting for your reply
Best regards,
Mahesh G
On 5/25/07, Adrian Chadd <adrian@creative.net.au> wrote:
> On Wed, May 23, 2007, Mahesh Govindappa wrote:
>
> > i wrote a simple program just for checking purpose.
> >
> > #include <stdio.h>
> > #include <string.h>
> >
> > int main()
> > {
> > char buf[8192];
> > fgets(buf, 256, stdin);
> > FILE *fp;
> > fp=fopen("/etc/test.txt", "w");
> > fprintf(fp,"%s", buf);
> > fclose(fp);
> > printf("OK\n");
> > }
> >
> > made it executable and run it and specified
>
> Its not enough; it needs to be in a loop.
> Something like:
>
> int main()
> {
> /* Be explicit about the buffering semantics for stdin/stdout as Squid requires it to be line buffered */
> setlinebuf(stdin);
> setlinebuf(stdout);
>
> fp = fopen("/etc/test.txt, "w");
> if (!fp)
> perror("Couldn't open /etc/test.txt for writing\n");
> /* This isn't needed, but it makes debugging easier as you'll immediately see the lines as they're authenticated */
> if (fp)
> setlinebuf(fp);
> while (! feof(stdin)) {
> if (fgets(buf, 256, stdin) == NULL)
> break;
>
> printf("OK\n");
> if (fp)
> fprintf(fp, "%s", buf);
> }
> close(fp);
> }
>
> Might do it.
>
>
>
> Adrian
>
>
-- Best regards, Mahesh.G
This archive was generated by hypermail pre-2.1.9 : Fri Jun 01 2007 - 12:00:09 MDT