Embedding xnest in C code

I hope I am posting this in the right section.

I have c file that is using the motif GUI toolkit to draw widgets and things of that sort. I also have another program that runs with xnest. I need to figure out a way to place that xnest program in my c code so that it exists in the window that the c code brings up.

Any ideas would be appreciated and thank you in advance.

Xnest -display display-variable -parent your-window-id ...

Does "display-variable" refer to the window ID of the window I want to embed or something and does "your-window-id" refer to the parent window in which the other window will be embedded?

I also do not know how I would put that Xnest command in a C file. The C compiler of course gives errors when I just put Xnest -options....

  1. the display refers to the DISPLAY variable, and would be some like 127.0.0.1:0.

  2. the -parent id refers to the window id that you want to be the parent of the Xnest window.

  3. Xnest is a program not a C procedure call. Use C's "system()" or "spawn()".