Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7743981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:40:04+00:00 2026-06-01T09:40:04+00:00

Is popen not supported by android NDK? I read this page and wondering if

  • 0

Is popen not supported by android NDK?

I read this page and wondering if this is true

The same is possible with POSIX popen() but it is not currently
supported by bionic, so you can’t use that in Android JNI. Instead you
can probably use the system() and pipe the output to a file and then
read that file afterwards. Looks like the Java approach will be
cleaner if you will be doing the rendering in Java.

But I also read someone suggesting to use popen. I also tried it myself but sometime my app crashes and I dont know why.

Is popen safe to use in android ndk?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T09:40:05+00:00Added an answer on June 1, 2026 at 9:40 am

    I think it depends on what version of the NDK you are using

    Also looking in the gingerbread source tree for bionic I did find an implementation of popen.
    The implementation might not be 100% posix of libc correct, but it is at least functional to some degree.

    Using NDK v6, the following example compiles without any problems, and it runs on my android device.

    #include <stdio.h>
    #include <stdlib.h>
    int main()
    {
     FILE *fpipe;
     char *command="/system/bin/ps";
     char line[256];
     if ( !(fpipe = (FILE*)popen(command,"r")) ) exit(1)
     while ( fgets( line, sizeof line, fpipe))
     {
       puts(line);
     }
     pclose(fpipe);
    }
    

    UPDATE:
    Seems than popen on pre ICS versions used vfork() instead of fork(), and those vfork() are known to cause stack corruption.

    So from ICS onward popen should be save to use, but on earlier android versions it is available but verry buggy.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

NOTE: This is not the same question as Python: Persistent shell variables in subprocess
I hope that this is not a stupid question. Is it possible to redirect
Having this code p = subprocess.Popen('tail -f /var/log/syslog', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) for line in
Python documentation to Popen states: Warning Use communicate() rather than .stdin.write, .stdout.read or .stderr.read
Say I write this: from subprocessing import Popen, STDOUT, PIPE p = Popen([myproc], stderr=STDOUT,
In order not to block the reactor I would like to read files asynchronously,
It's not the first time I'm having this problem, and it's really bugging me.
I'm having a problem where popen is deadlocking. Specifically, the thread (not the main
Let's say I spawn a process PO through popen (READ ONLY) from a process
Thanks in advance for any help. I am new to python, but not particularly

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.