Questions and issues

Trenix25

Member
Joined
Aug 15, 2017
Messages
71
Reaction score
18
Credits
550
I downloaded a C compiler for my tablet from the Play Store called C4droid. It cost $3. It locally compiles and runs a C program. The set up of an Android system is a problem though. I feel like I'm living in a tiny little box and every time I try to move to do anything I bump in to a wall. The file system permissions are set up in such a way that I can't run my code without this software setting it up and it can only set up one program at a time. I feel like I'm wearing handcuffs while using this tablet.

I have included a copy of my little program here along with its output...

bash-4.3$ cat /sdcard/C/show_args.c
#include <stdio.h>
#include <stdlib.h>

int main( int argc, char **argv )
{
int count;

printf( "Program name: %s\n", argv[ 0 ] );
if ( argc > 1 )
{
for( count = 1; count < argc; count++ )
{
printf( "argv[ %d ]: %s\n", count, argv[ count ] );
}
}
exit( 0 );
}

/* EOF */
bash-4.3$run
Program name: /data/data/com.n0n3m4.droidc/files/temp
bash-4.3$ ls -l /data/data/com.n0n3m4.droidc/files/temp
-rwxrwxrwx u0_a355 u0_a355 28784 2017-12-08 21:37 temp
bash-4.3$ ls -al /data/data/com.n0n3m4.droidc/files
opendir failed, Permission denied
bash-4.3$

The command 'run' is an alias to run the above program as it is sure a lot easier to type. If I copy the 'temp' binary to /sdcard/C/ then it winds up with 0660 instead of 0777 and is owned by root:sdcard_r showing me to be a member of the sdcard_r group.

The compiler also seems to support something called GIT. What is that? Does it stand for something like Graphical Interface Toolkit? This compiler is supposed to allow me to write and make my own apps (apk) right on my tablet, which would sure solve the one program at a time problem.

I used Termius to run the program in the listing above. The C4droid program has its own terminal emulator. The included shells on my tablet are extremely limited along with any command bins.

What do I need to #include and call to set up an apk app? Is there a free tutorial somewhere?

Any helpful comments would be appreciated. Thank you.

Signed,

Matthew Campbell
 


This forum seems to be removing my spaces which takes away line indentation.
 
This forum seems to be removing my spaces which takes away line indentation.
Yes, I've noticed this too... the forum software seems to remove excess whitespace. It will help readability if you enclose your code in [CODE] [/CODE] tags, and I think this will allow you to keep indents in your code too. You might also want to put your output in [CODE] [/CODE] tags or [QUOTE] [/QUOTE] tags to also help with readability. Indenting can otherwise be achieved using BBcode [INDENT] [/INDENT] tags. See more about BBcode options here.

Sorry I can't help with the code itself though.... programming has just never been my thing.:confused:

Git (assuming there is not something else to confuse with this) is a software version control management system originally written by Linux Torvalds. You can learn more about it here.

Cheers
 
Thank you sir.

I'd like to test that code idea...

Code:
#include <stdio.h>

int main( void )
{
     printf( "A little something here.\n" );
     return 0;
}

/* EOF */

Ok, let's see how that worked out...
 
Spaces and blank lines were successfully maintained. Thank you for the wonderful suggestion.
 
Let's try quoting and see what that looks like. Using CODE shrunk the font size which was very helpful.

This is line 1.

This is line three which is indented five spaces.
 
Despite being a programmer, I can't say I've ever tried using a terminal or a C compiler in Android. :/ Not sure what to suggest offhand.

If you want to develop applications for Android - you might want to consider taking a look at installing Android Studio onto a laptop or PC.
Then you will be able to build and package apps that you can install and run on your tablet. And if you don't want to use a full blown IDE, you could just get the Android SDK and NDK for your PC and build apps from the command line....

Otherwise, if you only want to use your tablet - there is MIT's appinventor website, which you should hopefully be able to use in your Android devices browser. But it's designed for non-coders to be able to create apps. It uses the same drag 'n drop style approach as the Scratch programming language (where you drag and drop tiles of code and put them together like a puzzle, filling in any blanks etc.)
 
I appreciate the responses. Thank you, both of you. I have an IDE app, I just haven't tried it yet. My C4droid app did manage to produce an apk file that I installed and it worked, but I could not specify command line arguments. Right now I'm only using my tablet. I haven't set up my laptop yet. It's going to be expensive to fix it up and I just can't afford to do that right now. I'm trying to figure out how to use inline assembly in C4droid, but it seems the opcode mnemonics are different. I have sent an email to the app developer asking for a list of allowed mnemonics and operands.

Signed,

Matthew Campbell
 

Members online


Latest posts

Top