not windows though, Linux
Code:
#include <stdio.h>
#include <string.h>
int main () {
char *str = "Hello"; // Please note that this is passed as an LPWSTR in my project, but I thought I should "un-typedef" it to accommodate for non-Windows programmers :)
char buf[3] = "00";
memcpy(&buf[0], &str[1],1);
printf("str %s : buf %s\n", str,buf);
char *str1 = "HELLO"; // Please note that this is passed as an LPWSTR in my project, but I thought I should "un-typedef" it to accommodate for non-Windows programmers :)
char buf1[3] = "00";
buf1[0] = str1[1];
printf("str1 %s : buf1 %s\n", str1,buf1);
return(0);
}
Code:
userx@slackwhere:~/bin
$ ./memcopy
str Hello : buf e0
str1 HELLO : buf1 E0