beos
2006-07-10, 16:24:03
Hi,
da ist einfach nicht weiterkomme - vielleicht könnt ihr mir helfen.
Das Programm bleibt einfach bei
if ((w_fifo = open (FIFO, O_WRONLY)) < 0)
hängen - es gibt aber keine Fehlermeldung....die Frage ist warum?
Hier das Listing:
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <sys/wait.h>
#include <errno.h>
#define FIFO "/tmp/fifo_0002"
int r_fifo, w_fifo;
char puffer[]="A";
char buf[1];
int main (void)
{
if ((mkfifo (FIFO, S_IRUSR | S_IWUSR)) == -1)
{
/* FIFO bereits vorhanden - kein fataler Fehler */
if(errno == EEXIST)
perror ("mkfifo() - FIFO Existiert schon - mache weiter");
else
{
perror("mkfifio()");
exit (EXIT_FAILURE);
}
}
if ((w_fifo = open (FIFO, O_WRONLY)) < 0)
{
perror ("open()");
exit (EXIT_FAILURE);
}
else
{
write (w_fifo, puffer, strlen(puffer));
}
if ((r_fifo = open (FIFO, O_RDONLY)) < 0)
{
perror ("open()");
exit (EXIT_FAILURE);
}
close (r_fifo);
close (w_fifo);
return (EXIT_SUCCESS);
}
da ist einfach nicht weiterkomme - vielleicht könnt ihr mir helfen.
Das Programm bleibt einfach bei
if ((w_fifo = open (FIFO, O_WRONLY)) < 0)
hängen - es gibt aber keine Fehlermeldung....die Frage ist warum?
Hier das Listing:
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <sys/wait.h>
#include <errno.h>
#define FIFO "/tmp/fifo_0002"
int r_fifo, w_fifo;
char puffer[]="A";
char buf[1];
int main (void)
{
if ((mkfifo (FIFO, S_IRUSR | S_IWUSR)) == -1)
{
/* FIFO bereits vorhanden - kein fataler Fehler */
if(errno == EEXIST)
perror ("mkfifo() - FIFO Existiert schon - mache weiter");
else
{
perror("mkfifio()");
exit (EXIT_FAILURE);
}
}
if ((w_fifo = open (FIFO, O_WRONLY)) < 0)
{
perror ("open()");
exit (EXIT_FAILURE);
}
else
{
write (w_fifo, puffer, strlen(puffer));
}
if ((r_fifo = open (FIFO, O_RDONLY)) < 0)
{
perror ("open()");
exit (EXIT_FAILURE);
}
close (r_fifo);
close (w_fifo);
return (EXIT_SUCCESS);
}