This is my first post and I would like to ask you a question about a mix of types into a char pointer.
I have defined a char pointer that will be filled with information from different types (int, float and char mainly) through sprintf. When I compile i get this message "warning: deprecated conversion from string constant to ‘char*’" and when I run I get segmentation fault.
I could use string types but the problem is that I have to convert one to type to an specific type and finally I have to convert this string into a char because mysql function don't accept string.
I have been seeking information but I didn't find a similar case.
What code is causing this? I assume you have something like:
1 2 3
char *a;
a = "hello";
sprintf(a, "%d", 5);
? That would explain the error, and indicate you should just stay away from char* and use strings until you actually understand how pointers and string constants etc work.
OK....I have many parts in my program that is concatenating information in this way and the solution (not god solution of course) that I have decided to use is to give a dimension to str and works good and there is no warning messages.