WCM Forum

WCM Forum (http://www.wcm.at/forum/index.php)
-   Programmierung (http://www.wcm.at/forum/forumdisplay.php?f=17)
-   -   Datentypen in C (http://www.wcm.at/forum/showthread.php?t=99223)

Pavlovs_Dog 06.06.2003 23:32

Datentypen in C
 
Hallo zusammen!

Ich hab noch niemals in C programmiert - deshalb sorry für die naive Frage!.

Ich will eine fifo-pipe anlegen - deren Namen aus einem konstanten Teil und der aktuellen prozess-ID besteht.


mkfifo("/tmp/fifo_0001", O_RDWR)

Blos 0001 sollte der Wert aus getpid() sein.

Kann mir da jemand weiterhelfen?

Danke!
LG
Pav

ReiniBugman 07.06.2003 12:57

Sollte so funktionieren:

....
char buffer[256];

sprintf( buffer,"/tmp/fifo_%04d",getpid() );
mkfifo( buffer, O_RDWR)
....

ob die id allerdings maximal 4stellig ist würd ich allerdings
mal hinterfragen...
%04d bewirkt, daß die Zahl 4stellig und mit Nullen aufgefüllt
formatiert wird.


Alle Zeitangaben in WEZ +2. Es ist jetzt 02:27 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© 2009 FSL Verlag