[NTLUG:Discuss] Continuation of pointer questions

Fred James fredjame at concentric.net
Wed Nov 27 15:02:23 CST 2002


First, thank you for all the input so far - here is what I have done, 
and it does the job except ...

#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
[omitted code for brevity]
	char *pC;
[omitted code for brevity]
	pC = (char*) malloc(strlen(pAttach) + strlen(pMessage) +10);
[omitted code for brevity]
         sprintf(mailCmd,
             "/usr/sbin/mailx -s '%s' %s", pSubject, pRecipientList);
[omitted code for brevity]
	strcpy (pC,"~| uuencode ");
	strcat (pC,pAttach);
	strcat (pC,"\n");
	strcat (pC,pMessage);
         if ( fwrite (pC, strlen (pC), 1, pMailPipe) == strlen (pC) )
[omitted code for brevity]

The "except" comes in the "strcpy() line.  What I am trying to do is put 
a line at the top of the message body that begins with "~|uuencode" and 
everything is OK until I put the tilde in, at which point the entire 
tilde command line disappears, leaving only the message body.  The 
"~|uuencode ..." line does work when tested at the shell level with: 
"cat $messagefile | mailx -s $subjectline $address"  I haven't been able 
to figure out how to quote it to get it through.
Thank you in advance for any help you can offer.

-- 
small is beautiful





More information about the Discuss mailing list