If the variable 'S' is inside a for loop, which stores the char value of the Binary value inputted by the user, how to append all the characters to form a String which I can pass to a ShellExecute() fucntion.
char *u="https://google.com";
ShellExecute(NULL, "open",u, NULL, NULL, SW_SHOWNORMAL); //this will open a webpage
^^^ Binary values should be input in such a way that 'u' is a URL that opens in the browser. This will be taken care by the user. Just referenced it.
The following, is to convert Binary -> Dec-> Char:
for(i=0; i<21; i++)
scanf("%ld",&n[i]); //Binary
for(i=0; i<21;i++)
{
k=n[i], c=0, decimalNumber=0;
while(k!=0)
{
remainder = k%10;
k /= 10;
decimalNumber += remainder*pow(2,c); //Dec
++c;
}
char S=decimalNumber; //Char
.
. //how do I join all the Char I am getting here in one String
.
}
Using this way causes A LOT OF ISSUES, but this was the only way I figured after doing a ton of reading...
char *u1=NULL;
char *u=NULL; //just after void main()
.
.
. //after I store char in 'S'
u1=u; //'u1' stores the string as 'u' gets deallocated every loop
size_t len=strlen(u1);
u=malloc(len + 1 + 1 );
strcat(u,u1); //copies the value of 'u1' from previous iteration to 'u'
u[len]=t;
u[len+1]='\0';
How do I store the characters in a String variable ?
Any small help is highly appreciated, Thanks! :)