Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
21 years ago

using prebuilt binaries in applications

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/unsure.gif

I doownloaded the linux kernel and filesystem into my altera stratix board.

There i was able to create a e2fs filesystem in the compact flash using commands through the serial port.

What i wanted to know is if i want to call these prebuitl binary functions like

"fdisk", "mke2fs",etc

from my application directly(i.e.as function calls) how do i do it?

Is it possible.

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You might like to look into the "system" function, and "exec" and friends. However, if you find that your application mostly just runs other programs you could probably replace it with a shell script (or maybe even perl script: does perl run on these systems yet?). Excerpt from the system manpage:

    <div class='quotetop'>QUOTE </div>

    --- Quote Start ---

    synopsis

    # include <stdlib.h>

    int system(const char *string);

    description

    system() executes a command specified in string by calling /bin/sh -c string, and returns after the command has been completed. During execution

    of the command, SIGCHLD will be blocked, and SIGINT and SIGQUIT will be ignored.[/b]

    --- Quote End ---

    HTH.