Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 721
  • Last Modified:

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
0
AjishJose
Asked:
AjishJose
  • 2
1 Solution
 
Infinity08Commented:
You could use sprintf instead of printf ...
0
 
Infinity08Commented:
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 ...
0
 
Let_Me_BeCommented:
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).
0
 
AjishJoseAuthor Commented:
The solution of changing printf to sprintf is ruled out as I am executing the VxWorks routines of which I dont have any contol of.
The other two also did not serve my purpose.
Eventually, pipes came to the rescue.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now