Temporary Standard Input – UPDATE

About Monkey 2 Forums Monkey 2 Development Temporary Standard Input – UPDATE

This topic contains 4 replies, has 3 voices, and was last updated by  Danilo 2 years, 1 month ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #5439

    scurty
    Participant

    Hello, I come with a temporary solution on getting standard input from a Console/Terminal because I can’t find a method in Monkey2. xD So far this seems to work in in Linux, not sure about other Targets. Seems a little “hacky” but it works. I might improve it later on. Feel free to use in whatever. Haha.

    Easy and Familiar usage.

    Peace be with you. 😛

    ^^^ Is now obsolete.
    ——– UPDATE ——-

    Recompile the libc.monkey2 module. (./scripts/rebuildmods.sh) for Linux/Mac (./scripts/rebuildmods.bat) Windows

    Basic Usage Example Project:

    Hopefully this can get commit to the build? *hint* *hint*

    #7295

    abakobo
    Participant

    Just tested you snippet but the update gave me a memory access violation..

    First example worked though.

    EDIT: had to modify a bit because the string was not ending correctly..

    [/crayon]
    #7296

    Danilo
    Participant

    You need to allocate memory for the buffer in the first line.
    Just ‘buffer:char_t’ is not a memory buffer of 1024 chars.

    #7298

    abakobo
    Participant

    do you recommend that I create a new array
    buffer = new int[1024] ?
    in C it will be

    [/crayon]

    but in monkey how would I reserve the memory without the use of the Cast operator?

    or should i use malloc!?

    #7302

    Danilo
    Participant

    Like you did with ‘New Byte’ in the other code:

    You access the address of the buffer using ‘VarPtr buffer[0]’

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.