8 Replies - 14378 Views - Last Post: 05 March 2008 - 11:29 AM Rate Topic: -----

#1 fsloke  Icon User is offline

  • D.I.C Regular

Reputation: 25
  • View blog
  • Posts: 412
  • Joined: 19-December 07

Pause code

Post icon  Posted 15 February 2008 - 02:04 AM

Got any sample code can PAUSE running code....

After press "Enter" button the program continue run....

Thank
Is This A Good Question/Topic? 0
  • +

Replies To: Pause code

#2 PennyBoki  Icon User is offline

  • system("revolution");
  • member icon

Reputation: 53
  • View blog
  • Posts: 2,334
  • Joined: 11-December 06

Re: Pause code

Posted 15 February 2008 - 02:46 AM

Maybe this would work

while(userInput!='\n')
{
	userInput=inputFunction();
}

This post has been edited by PennyBoki: 15 February 2008 - 02:56 AM

Was This Post Helpful? 0
  • +
  • -

#3 bhandari  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 9
  • View blog
  • Posts: 754
  • Joined: 31-January 08

Re: Pause code

Posted 15 February 2008 - 05:29 AM

Quote

userInput=inputFunction();


inputFunction() to read one character from console/inputstream
Was This Post Helpful? 0
  • +
  • -

#4 PennyBoki  Icon User is offline

  • system("revolution");
  • member icon

Reputation: 53
  • View blog
  • Posts: 2,334
  • Joined: 11-December 06

Re: Pause code

Posted 15 February 2008 - 06:52 AM

View Postbhandari, on 15 Feb, 2008 - 05:29 AM, said:

Quote

userInput=inputFunction();


inputFunction() to read one character from console/inputstream

Thanks for clarifying that.
Was This Post Helpful? 0
  • +
  • -

#5 bhandari  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 9
  • View blog
  • Posts: 754
  • Joined: 31-January 08

Re: Pause code

Posted 15 February 2008 - 06:54 AM

you are welcome
Was This Post Helpful? 0
  • +
  • -

#6 fsloke  Icon User is offline

  • D.I.C Regular

Reputation: 25
  • View blog
  • Posts: 412
  • Joined: 19-December 07

Re: Pause code

Posted 17 February 2008 - 01:09 AM

In C++ is

SYSTEM('PAUSE');

BUt in Java, have to do it like this?

Quote

while(userInput!='\n')
{
userInput=inputFunction();
}


Can I put it in the middle of the code?

I use this PAUSE function to check my coding only....


Thank...

-fsloke
Was This Post Helpful? 0
  • +
  • -

#7 PennyBoki  Icon User is offline

  • system("revolution");
  • member icon

Reputation: 53
  • View blog
  • Posts: 2,334
  • Joined: 11-December 06

Re: Pause code

Posted 17 February 2008 - 04:04 AM

OK now I think I know what you want. You want to hold the execution window open. Java does not have that "problem" like C++. You should be able to view the result wuthout any extra "pause" code.
So you don't need any of the above, and please next time try to explain better what is it that you want to know.
Was This Post Helpful? 0
  • +
  • -

#8 fsloke  Icon User is offline

  • D.I.C Regular

Reputation: 25
  • View blog
  • Posts: 412
  • Joined: 19-December 07

Re: Pause code

Posted 04 March 2008 - 02:20 AM

I just caught what you all mean...

insert input in Java mean PAUSing the program...

Thank guys...
Was This Post Helpful? 0
  • +
  • -

#9 gl3thr0  Icon User is offline

  • D.I.C Regular

Reputation: 19
  • View blog
  • Posts: 319
  • Joined: 27-October 07

Re: Pause code

Posted 05 March 2008 - 11:29 AM

Thread t = Thread.currentThread(); lets u access the main as a thread

t.sleep(x); puts the main to sleep for x millSeconds

t.resume(); wake up the main

more compliacted bt more fun :D


id still go with the userinput though waaaay easier :P jus dsnt look all cool... haha
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1