view c/strlen.c @ 4:57b2c00b9dc6

file rename read_lseek.cc to main.cc & remove lseek
author Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
date Fri, 13 Dec 2013 10:08:58 +0900
parents c1968e54b0da
children
line wrap: on
line source

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

unsigned char *gWord = 0;

int main(){

    gWord = "testcode";

    int w_len = sizeof(gWord);
    unsigned char *word = (unsigned char *)malloc(w_len + 1);

    memcpy(word,gWord,w_len + 1);

    printf("%s\n",word);
    printf("length:%d\n",w_len);

    free(word);

    return 0;
}