0

i have to generate a PDF with a dynamic calendar, the main program must be written in C. Is there a way that i could call a JS function in my program to do it? Or "link" both. I'm using windows Thanks

TheSnow
  • 3
  • 1
  • Do you have a JavaScript runtime you can embed in C? Would it be easier to fork a `node` process? – tadman Jun 13 '19 at 21:07
  • You could embed a JS engine in your program or execute a command that runs JS. Perhaps take a look at https://stackoverflow.com/questions/2941411/executing-javascript-without-a-browser – jspcal Jun 13 '19 at 21:11
  • But i don't understand how could i execute a command that runs JS in C... Is that possible? How? With an external library? – TheSnow Jun 13 '19 at 22:18
  • The easiest approach might be to write a complete JS program that takes input from a file and writes output to a file. Then, the C program sets up its input, calls the JS program with system(), then finishes with its output. – Lee Daniel Crocker Jun 13 '19 at 22:43
  • That would be a great ideia @LeeDanielCrocker , but i have to print a specific month from a specific year, the C program recieve the input with the month and year the user wants to print and calculate how many days the month has. Is there a way to "pass" a variable which contains the number of days to the JS program with the system()? – TheSnow Jun 13 '19 at 23:31
  • In a file, on the command line, over a socket, over a pipe... – Lee Daniel Crocker Jun 13 '19 at 23:52

0 Answers0