문제

This question might be a bit pointless, but I thought it was interesting and I don't know how to find an answer to it otherwise.

I wrote a brainfuck interpreter that takes programs (or file paths) as arguments from the command line; i.e.

brainfuck >++++++++[<++++++++>-]<.

outputs @. Or, it's supposed to, anyway. Actually running this in cmd gives an "Access is denied" error if the argument is not enclosed in double quotes. I assume it has something to do with cmd trying to parse the square brackets; do they have any particular function in cmd?

도움이 되었습니까?

해결책

Your problem are not square backets. You problem are < and >. They are intended to handle stream redirection, < xxx means get input from xxx, > xxx means send output to xxx

You can enclose the text in double quotes or can escape the "problematic" characters preceding them with a caret

brainfuck ">++++++++[<++++++++>-]<."
brainfuck ^>++++++++[^<++++++++^>-]^<.
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top