Link to home
Start Free TrialLog in
Avatar of AjishJose
AjishJose

asked on

How do I redirect the stdout to a memory buffer. Technology C,VxWorks

I am writing a crash debug mechanism which requires me to execute the VxWorks routines like i, taskShow etc in the Exception Handler context. I would have opted to redirect the output to a file in the flash device, but this is time consuming. Is there a way in which I can redirect the output to a memory buffer.

Thanks
Ajish
Avatar of Infinity08
Infinity08
Flag of Belgium image

You could use sprintf instead of printf ...
If you're ok with having this system dependent, and your OS has a concept of (shared) memory files (like /dev/shm in Linux), you could simply redirect stdout to such a file ...
If you want to redirect, you can use POSIX function dup/dup2. They of course won't work on Windows OS (after adding the POSIX package from Microsoft, they might, but I'm not a Windows expert).
ASKER CERTIFIED SOLUTION
Avatar of AjishJose
AjishJose

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial