R
Rocke Robertson
Take it easy on me. I dont do a lot of programmng, only on a as needed
basis. For the life of me, I cant get rid of the error. Its the usual
casting problem. But I have cast the return type properly havent I ?
Here is the error....
larg.c: In function `page_n_loggit':
larg.c:29: warning: assignment makes pointer from integer without a cast
The error is refering to the popen() function. Below is all the code.
#include <stdio.h>
#include <stdlib.h>
page_n_loggit(char * host, char * str) {
static FILE *logfp;
static FILE *ptr;
char fn[] = " ";
char PatrolAlert[] = "Patrol Alert 1.0";
char PatrolLDAPErr[] = "CUSTOM_LDAP.gtis0.ldapStatus";
char alarm[] = "ALARM";
char *cmd;
/* Prime rand() */
srand(getpid());
sprintf(fn,"patfile.%d",rand());
if ((logfp = fopen(fn, "w")) == NULL)
perror("fopen failed");
fprintf(logfp,
"%s\n%s\n%s\n%s\n%s\n",PatrolAlert,PatrolLDAPErr,host,str,alarm);
fflush(logfp);
fclose(logfp);
sprintf(cmd, "/gtis/bin/ftp_file %s /alarm", fn);
if (( ptr = popen(cmd, "w")) == NULL)
perror("popen");
exit(0);
}
basis. For the life of me, I cant get rid of the error. Its the usual
casting problem. But I have cast the return type properly havent I ?
Here is the error....
larg.c: In function `page_n_loggit':
larg.c:29: warning: assignment makes pointer from integer without a cast
The error is refering to the popen() function. Below is all the code.
#include <stdio.h>
#include <stdlib.h>
page_n_loggit(char * host, char * str) {
static FILE *logfp;
static FILE *ptr;
char fn[] = " ";
char PatrolAlert[] = "Patrol Alert 1.0";
char PatrolLDAPErr[] = "CUSTOM_LDAP.gtis0.ldapStatus";
char alarm[] = "ALARM";
char *cmd;
/* Prime rand() */
srand(getpid());
sprintf(fn,"patfile.%d",rand());
if ((logfp = fopen(fn, "w")) == NULL)
perror("fopen failed");
fprintf(logfp,
"%s\n%s\n%s\n%s\n%s\n",PatrolAlert,PatrolLDAPErr,host,str,alarm);
fflush(logfp);
fclose(logfp);
sprintf(cmd, "/gtis/bin/ftp_file %s /alarm", fn);
if (( ptr = popen(cmd, "w")) == NULL)
perror("popen");
exit(0);
}