Line feeds and newlines

2020-10-24 Thread AyJayKay
Hi, seems like the old nimrod-code dot org domain got diverted. The links don't work anymore and forward to advert or phishing sites.

Redirect stdout for certain execution

2020-10-14 Thread AyJayKay
Maybe they should even be called `duplicateFileHandle(handle)` and `assignFileHandle(source, target)`. I made a helper for my project now that can do `setStdout(file)` and `resetStdout()`. And same for std error and input. (I like descriptive names and simple interfaces :D )

Redirect stdout for certain execution

2020-10-12 Thread AyJayKay
So, I fiddled around a little. First things first: I found dup and dup2 in the MingW sources. Is this why it is working out of the box when compiling from MacOS to Windows? Anyways, your solution - with importing the dups - does the thing for windows, too :) Consider the lovely phrase from the

Redirect stdout for certain execution

2020-10-12 Thread AyJayKay
Damn it, you are right. I can't compile for windows. With some pointer errors... I will look a little deeper into this when I've got some time.

Redirect stdout for certain execution

2020-10-11 Thread AyJayKay
Thanks, @Clonk for the quick reply! Appreciate it! If I am not mistaken, the SO answer does the same as my code just with reusing unistd.h instead of writing it "pure Nim". (Isn't my solution more platform independent?) They are also saving to file. And instead of using reopen() proc, they clos

Redirect stdout for certain execution

2020-10-11 Thread AyJayKay
Hello dear community! I want to encapsulate some code's returned stdout and grab it for later (not stream to output). I am kind of un-knowledgable when it comes to the stdout and application streaming. I came up with the following: import streams const tempStdoutFileName =