Fork me on GitHub
beagleboard.org

BoneScript

You might be able to see a newer version of this on beagleboard.org/support/bonescript/writeCModule

writeCModule(filename, code, [callback])

write a C program with Source code provided in the code input at the filename path.

Arguments

  • filename: complete path of the file to be written
  • code: code string to be written
  • callback: called upon completion

callback(x)

  • x.err: error status message

Example

var b = require('bonescript');
var code = `
#include 
int main(int argc)
{
   printf("Hello, World!");
   return 0;
}`; //code enclosed between ``
b.writeCModule('/usr/share/bone101/examples/extras/helloworld', code);

Build and execute instructions

  • Be careful not to overwrite important files!
  • Run the above to generate a helloworld.c file at the path and use loadCModule to compile and run.
  • Modify the C code.

See also

Related functions