C++ in VSCode - Getting Started

时间:2016-02-12 22:03:52

标签: c++ visual-studio-code

I'm having trouble getting a simple C++ script to run in VSCode (I'm new to both). I followed these instructions, and the status bar displays "C++" on the bottom right of the screen, next to the smiley face. I then ran the following script:

function onResult (decodeResults, readerProperties, output)
{
    if(decodeResults.toString)
    {
      var OkunanBarkod = decodeResults[0].content;

            while(OkunanBarkod.match('\xc5') && OkunanBarkod.match('\x9f') && (OkunanBarkod.indexOf('\xc5') == (OkunanBarkod.indexOf('\x9f')-1)))
            {       
                OkunanBarkod = OkunanBarkod.replace('\xc5', 's');

                OkunanBarkod = OkunanBarkod.replace('\x9f', '');            
            }

            while(OkunanBarkod.match('\xc3') && OkunanBarkod.match('\xb6') && (OkunanBarkod.indexOf('\xc3') == (OkunanBarkod.indexOf('\xb6') - 1)))
            {       
                OkunanBarkod = OkunanBarkod.replace('\xc3', 'o');

                OkunanBarkod = OkunanBarkod.replace('\xb6', '');            
            }



            output.content = OkunanBarkod;

    }
    else{
        output.content = "no";
    }

When I run it, the script's path flashes on the output screen and disappears. I expected it to display "Hello World" in the output.

I can run the script from the command window (I'm in Ubuntu) and the output file behaves as expected when executed.

1 个答案:

答案 0 :(得分:0)

Your program prints message to STDOUT and exits. Add some kind of wait (you can read STDIN for example) if you want to see its output.

PS: Why do you call your program "script"?