Topic: How to get all arguments pased in printf format from ruby in C program
I have implemented Ruby C extension(i.e. Invoking C function from ruby script) Following is the variable argument function implemented in C from file "cImplementation.c"
#include<stdio.h>
static VALUE cFunction(VALUE self, const char* fmt, ...)
{
return Qnil;
}
void Init_MyRuby()
{
VALUE MRuby = rb_define_module("MyRuby");
rb_define_singleton_method(MRuby, "cFunction", cFunction, 1);
}
Following is the code of ruby script that invokes cFuncton() method by pssing printf formated string as below:
require 'cFile'
MyRuby::cFunction("My Message:: %s, My Value:: %d", "Hi Im here", 100 )
Can any one suggest me how to access this printf formated string in C functon so that value should be printed as per access specifier? e.g.output in C function expected like=> My Message:: Hi Im here, My Value:: 100 Thanks in advance.