can someone look at this? sorry if its o-t

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hay list,
I know this is off-topic, but it says fdata is out of scope, can someone look at it and tell me what is going on?
Thanks,
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <syslog.h>
#include <cstdlib>
#include <iostream>
struct data{
int alt;
char *data;
char *usern;
};
using namespace std;
int main()
{
openlog("Dataplus client", LOG_PID, 0);
 switch ( fork() ) {
case -1:
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), "There was an error starting the dataplus client.");
return 1;
case 0:
break;
return 0;
}
if ( setsid() < 0 )
{
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), "There was an error starting the dataplus client.");
return 2;
}
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_NOTICE), "Dataplus client ready.");
data usr;
usr.alt=322;
usr.data="linux";
usr.usern="tyler/root";
dfile=fopen("darg", "w");
int i;
for (i = 0; i++; i < 12)
{
printf(dfile, usr);
fflush(dfile);
}
fclose(dfile);
return 0;
}


[Index of Archives]     [Linux for the Blind]     [Fedora Discussioin]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]
  Powered by Linux