Q: getenv + string in c and converting types I want to add /home/username + "/path.png?5667!http-get:*:image/png:!!!!!" just as in Java. but in C
name = malloc(strlen(hm)+strlen("/path.png?5667!http-get:*:image/png:!!!!!") + 2);
#include <stdlib.h>
#include<stdlib.h>
#include<string.h>
char *hm;
char *full;
hm = getenv("HOME");
full = malloc(strlen(hm)+strlen("/path.png?5667!http-get:*:image/png:!!!!!") + 2);
printf("name = %s\n",name);

I expect: /home/username/path.png?5667!http-get:*:image/png:!!!!!"

A: Don't be afraid to use str utilities. man strcpy, man strcat.
Here is what I think you want (Unclear from post):
#include <stdlib.h>
#include <string.h>
#include <stdio.h>

int     main()
{
  char* home = getenv("HOME");
  char* add = "/path.png?5667!http-get:*:image/png:!!!!!";
  char* full = malloc(strlen(home) + strlen(add) + 1);
  strcpy(full, home);
  strcat(full, add);
  printf("Full = %s", full);
  return 0;
} 

