Hi, While answering, please to answer to the list. Vincenzo Mallozzi a écrit : > how can I use snprintf()? > I have to execute, in a kernel module, an instruction like this: > > temp = (char *) Itoa((int) pid); How could your Itoa() function work ? Would it allocate the memory to contain the character string ? > where pid is of type pid_t. Basically, do something like : char pid_string [16]; snprintf (pid_string, sizeof(pid_string), "%d", pid); Maybe "%d" should be adapted to match better the pid_t (might be unsigned for example). > For example, I need strtok() to extract tokenized substrings for a given > string. As said in http://janitor.kernelnewbies.org/docs/driver-howto.html#3.3.1, one shouldn't use strtok() which is not thread-safe nor SMP-safe. You should use strsep() instead, available in <linux/string.h>. Basically, I found these informations with 2 minutes of Googling. Google *really* is your friend. Sincerly, Thomas -- PETAZZONI Thomas - thomas.petazzoni@xxxxxxxx http://thomas.enix.org - Jabber: thomas.petazzoni@xxxxxxxxx KOS: http://kos.enix.org/ - SOS: http://sos.enix.org Fingerprint : 0BE1 4CF3 CEA4 AC9D CC6E 1624 F653 CB30 98D3 F7A7
Attachment:
signature.asc
Description: OpenPGP digital signature