Anonymous
Why
Because writing android apps with C++ is a bad idea
AHMED
I am learning c++ for embedded systems. But I have my reasons to make android app using c++.
AHMED
Hahaha
Diego
It's worth mentioning that, at least afaik, Android doesn't really natively support C++ apps Android is based on the Linux Kernel, which is C and C++, but primarily The Android OS is Java
Anonymous
Anyone Need netflix account with 4 Screen Premium ultra HD auto renewal only for 100rs Dm me if you want to buy
Damo
Please can anyone suggest me you tube channel to learn kernel device driver
Ибраги́м
Pavel
Because writing android apps with C++ is a bad idea
Why it's a bad idea by the way?
PO
HI, If some one would like to transforme an array of int into a string, how would you do? I made a function to convert each element of type int to char type and then I used this function inside a for loop to do that but I get a strange character when I print my string. someone can help me 🙏🏻
Pavel
Why it's a bad idea by the way?
As far as I remember both Android Studio and Visual Studio support writing native apps using C++ I tried android studio with android NDK long time ago and it had some issues, but this still better than to write two different implementations for Android and ios
Anonymous
Why it's a bad idea by the way?
Because C++ is not a main language for Android development
Pavel
Because C++ is not a main language for Android development
That doesn't matter much as for today in my opinion, it's not limited to Java only right now
Anonymous
In Android apps it can be used for: 1. Writing main components for cross-platform apps — because the only language that is kinda native for every platform 2. Writing high performance parts of the app
Anonymous
That doesn't matter much as for today in my opinion, it's not limited to Java only right now
It does matter Kotlin is the number one language for Android development. All new libraries and frameworks are developed for this language
Anonymous
Yes, you right, I was talking about the first point. UI specific stuff (front-end?) is better to be written in Java I think
https://gusc.lv/2021/03/how-to-use-c-for-cross-platform-development/ Related article
PO
/ * convert_Int_Char * @pre: int > 0 * @post: converting a int to char */ static int convert_Int_char(int integer){ //assert(integer > 0); char character = integer + '0'; return character; } / * convert_Int_string * @pre: array != NULL && seedSize > 0 * @post: converting and inserting a array into char string */ static void convert_Int_string(LFSR *ptr , char *string){ assert(ptr != NULL && string != NULL); for(unsigned int i = 0; i < ptr->seedSize; i++){ string[i] = convert_Int_char(ptr->seed[i]); } }
Nils
C
well iterate through your array, convert each int via sprintf and done
PO
When i print my string after converting I get this [01101000010100010000�]
Nils
PO
i can't understand what is it this chracter
Nils
i can't understand what is it this chracter
Seems like there is some integer outside the range
Nils
As said just use sprintf instead.
PO
100% sure?
my input is 01101000010100010000 inside an int array
Nils
my input is 01101000010100010000 inside an int array
And you are sure that your int array is fully initialised?
PO
probably missing null terminator
what do you suggest me?
Mar!o
what do you suggest me?
string[strlen(string)] = '\0';
Nils
what do you suggest me?
Every string in C has to end with '\0' character
PO
string[strlen(string)] = '\0';
I'm sorry but I can't undertand, what should i do with that?
PO
Yeah or that way
if I use sprint, will it work do you think?
Mar!o
I'm sorry but I can't undertand, what should i do with that?
do this at the end of your string conversion function
Nils
if I use sprint, will it work do you think?
Why not? It will also make your program work with integers higher than 9 😉
PO
do this at the end of your string conversion function
static void convert_Int_string(LFSR *ptr , char *string){ assert(ptr != NULL && string != NULL); for(unsigned int i = 0; i < ptr->seedSize; i++){ string[i] = convert_Int_char(ptr->seed[i]); string[strlen(string)] = '\0'; } } Doesn't work but i don't know if i use correctly or not
PO
sprintf
like that sprintf(string, ptr->seedSize,"%d", ptr->seed[i]); shouldn't give the string size?
Nils
sprintf(outstring, "%d", ptr->seed[0]);
PO
I fixed my code just by addding -1 in my loop
PO
❤️
PO
Oh.
I change the value I get it again
PO
you do not need to do it in the loop only once at the end
I use like that and i get this: static int convert_Int_char(int integer){ //assert(integer > 0); char character = integer + 48; return character; } /** * convert_Int_string * @pre: array != NULL && seedSize > 0 * @post: converting and inserting a array into char string */ static void convert_Int_string(LFSR *ptr , char *string){ assert(ptr != NULL && string != NULL); //unsigned int size = ptr->seedSize; for(unsigned int i = 0; i < ptr->seedSize-1; i++){ string[i] = convert_Int_char(ptr->seed[i]); } ptr->seed[strlen(ptr->seed)] = '\0'; } [0110100001010001000��]
H
i can't understand what is it this chracter
save it as file and check by hexeditor , it's better to debug.
Your
Can I learn to program websites and create pages from the phone like html
Nameful
Why
It's tedious to write code on a phone And this is off-topic
Your
It's tedious to write code on a phone And this is off-topic
I do not have a computer. This is why I want to learn from the phone. If someone uses the phone, I want programs that can be used on the phone
Otumian
Your
How to link html with another editor
klimi
Can I learn to program websites and create pages from the phone like html
Yes but do talk about c/c++ here only. Or move to offtopic group
Andrew
Just google it
Diego
Yes...there are programs to install web servers on the phone..
But a phone is usually far to weak to run a web server, even if for testing It'd drain your battery too
Hanz
Supply me bro
Anonymous
Using nested loop and selection structure, print the following shape on the screen by repeating printf(“%d”, x) where the value of x could be 0 or 1. 01010 01010 01010 01010 01010