### RKCROCKS144's blog

By RKCROCKS144, history, 7 weeks ago,

I recently started using Node JS for programming, and I had written code that take input from stdin (command prompt) in windows. The difficulty arises here is that I go on inputting values and it didn't stopped (i.e. didn't reached the end). I searched over internet and found some saying that use CTRL-D or CTRL-V, but both is not working for me. Is there anything missed up or any other method to resolve it.

Any help would be appreciated. Thanks to community.

• +5

 » 7 weeks ago, # | ← Rev. 2 →   0 Here is the code I had written. process.stdin.resume(); let inputstring = ''; let currentLine = 0; process.stdin.on('data', (inputStdin) => { inputstring += inputStdin; process.stdout.write("input Called\n"); }); process.stdin.on('end', () => { inputstring = inputstring.split('\n'); let t = Number(inputstring[0]); let i = 1; process.stdout.write("End Called\n"); while (t--) { let x = Number(inputstring[i++]); solve(x); } }); function solve(n) { for (let i = n; i > 0; --i) { console.log(i); } } 
•  » » 7 weeks ago, # ^ |   0 Why did you write the code in the comments? Why not in the blog itself?
 » 5 weeks ago, # |   0 replace "process.stdin.on('end',function)" to "process.on("SIGINT", the function)" and then use ctrl+C to end