Skip to contentSkip to conversation

Doubt

DISCUSSION so usp 3 participants 3 messages Jun 28, 2004

lore
Share & tools
lore

so usp

author
#0 lore raw

Hi...

i would like to know how to copy a string such as "Test" to a char vector (char buffer[256]) in kernel mode.

Thanks,
Luis Henrique.

______________________________________________________________________

Yahoo! Mail - agora com 100MB de espaço, anti-spam e antivírus grátis!
http://br.info.mail.yahoo.com/

#1 lore raw

Example from arch/i386/kernel/kgdb_stub.c:

#include <asm/string.h> /* for strcpy */

static char remcomOutBuffer[BUFMAX];

strcpy(remcomOutBuffer, "OK");

Hope it's ok.

Quoted 19 lines · so usp

Hi...

i would like to know how to copy a string such as "Test" to a char vector (char buffer[256]) in kernel mode.

Thanks,
Luis Henrique.

______________________________________________________________________

Yahoo! Mail - agora com 100MB de espaço, anti-spam e antivírus grátis!
http://br.info.mail.yahoo.com/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw

Am Mo, den 28.06.2004 um 20:59 Uhr +0200 schrieb Esteve Espuña Sargatal:

Quoted 7 lines

#include <asm/string.h> /* for strcpy */

static char remcomOutBuffer[BUFMAX];

strcpy(remcomOutBuffer, "OK");

Hope it's ok.

Not really. Well, this example here works, but only if you know that you won't overflow the buffer.

strlcpy(emcomOutBuffer, "OK", BUFMAX);

(replace "OK" with the string you wish to copy)