How to detect End of file

View: New views
7 Messages — Rating Filter:   Alert me  

How to detect End of file

by nope n :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hi everyone,


I have difficulties detecting the EOF when I press ctrl-D at the netbeans output window.

Here is the code I am using for detecting eof when pressing ctrl-D:


def main(args: Array[String]) = {
    var line:String = ""
    do{
        line = readLine()
        println(line)
    }while(line != null)
  }


When using Ctrl + D, the loop doesn't end and the code that follows the loop is not executed.


thank you,

Francisco Perez



Create a cool, new character for your Windows Live™ Messenger. Check it out

Parent Message unknown Re: How to detect End of file

by Naftoli Gugenheim :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I don't use netbeans, but why do you expect Ctrl-D to send an EOF? Does Netbeans do that for Java? Or is that what happens in a linux shell? (For windows command prompt it's Ctrl-Z)

-------------------------------------
nope n<kingofadr1_@...> wrote:




Hi everyone,



I have difficulties detecting the EOF
when I press ctrl-D at the netbeans output window.Here is the code I am using
for detecting eof when pressing ctrl-D:
def main(args: Array[String]) = {
    var line:String = ""
    do{
        line = readLine()
        println(line)
    }while(line != null)
  }

When using Ctrl + D, the loop doesn't end and the code that follows the loop is not executed.
thank you,Francisco Perez





_________________________________________________________________
Create a cool, new character for your Windows Live™ Messenger.
http://go.microsoft.com/?linkid=9656621

RE: How to detect End of file

by nope n :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hi,
NetBeans uses GNU compilers and environment and in the GNU world Ctrl+Z stops the application, while end of stream is Ctrl+D. 




> Date: Mon, 6 Jul 2009 21:00:40 -0700
> From: naftoligug@...
> To: kingofadr1_@...; scala-user@...
> Subject: Re: [scala-user] How to detect End of file
>
> I don't use netbeans, but why do you expect Ctrl-D to send an EOF? Does Netbeans do that for Java? Or is that what happens in a linux shell? (For windows command prompt it's Ctrl-Z)
>
> -------------------------------------
> nope n<kingofadr1_@...> wrote:
>
>
>
>
> Hi everyone,
>
>
>
> I have difficulties detecting the EOF
> when I press ctrl-D at the netbeans output window.Here is the code I am using
> for detecting eof when pressing ctrl-D:
> def main(args: Array[String]) = {
> var line:String = ""
> do{
> line = readLine()
> println(line)
> }while(line != null)
> }
>
> When using Ctrl + D, the loop doesn't end and the code that follows the loop is not executed.
> thank you,Francisco Perez
>
>
>
>
>
> _________________________________________________________________
> Create a cool, new character for your Windows Live™ Messenger.
> http://go.microsoft.com/?linkid=9656621


We are your photos. Share us now with Windows Live Photos.

Parent Message unknown RE: How to detect End of file

by Naftoli Gugenheim :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I don't know for a fact but I'd be very surprised if its Swing GUI worked that way. What makes you say that it uses GNU compilers/environment?

-------------------------------------
nope n<kingofadr1_@...> wrote:




Hi,

NetBeans uses GNU compilers and environment and in the GNU
world Ctrl+Z stops the application, while end of stream is Ctrl+D.




> Date: Mon, 6 Jul 2009 21:00:40 -0700
> From: naftoligug@...
> To: kingofadr1_@...; scala-user@...
> Subject: Re: [scala-user] How to detect End of file
>
> I don't use netbeans, but why do you expect Ctrl-D to send an EOF? Does Netbeans do that for Java? Or is that what happens in a linux shell? (For windows command prompt it's Ctrl-Z)
>
> -------------------------------------
> nope n<kingofadr1_@...> wrote:
>
>
>
>
> Hi everyone,
>
>
>
> I have difficulties detecting the EOF
> when I press ctrl-D at the netbeans output window.Here is the code I am using
> for detecting eof when pressing ctrl-D:
> def main(args: Array[String]) = {
>     var line:String = ""
>     do{
>         line = readLine()
>         println(line)
>     }while(line != null)
>   }
>
> When using Ctrl + D, the loop doesn't end and the code that follows the loop is not executed.
> thank you,Francisco Perez
>
>
>
>
>
> _________________________________________________________________
> Create a cool, new character for your Windows Live™ Messenger.
> http://go.microsoft.com/?linkid=9656621

_________________________________________________________________
We are your photos. Share us now with Windows Live Photos.
http://go.microsoft.com/?linkid=9666047

Parent Message unknown RE: How to detect End of file

by Naftoli Gugenheim :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In any case, try running your app in a real terminal and see if it behaves. If it does you'll know that netbeans is the "culprit," and if not then you know you have a problem with your code.

-------------------------------------
nope n<kingofadr1_@...> wrote:




Hi,

NetBeans uses GNU compilers and environment and in the GNU
world Ctrl+Z stops the application, while end of stream is Ctrl+D.




> Date: Mon, 6 Jul 2009 21:00:40 -0700
> From: naftoligug@...
> To: kingofadr1_@...; scala-user@...
> Subject: Re: [scala-user] How to detect End of file
>
> I don't use netbeans, but why do you expect Ctrl-D to send an EOF? Does Netbeans do that for Java? Or is that what happens in a linux shell? (For windows command prompt it's Ctrl-Z)
>
> -------------------------------------
> nope n<kingofadr1_@...> wrote:
>
>
>
>
> Hi everyone,
>
>
>
> I have difficulties detecting the EOF
> when I press ctrl-D at the netbeans output window.Here is the code I am using
> for detecting eof when pressing ctrl-D:
> def main(args: Array[String]) = {
>     var line:String = ""
>     do{
>         line = readLine()
>         println(line)
>     }while(line != null)
>   }
>
> When using Ctrl + D, the loop doesn't end and the code that follows the loop is not executed.
> thank you,Francisco Perez
>
>
>
>
>
> _________________________________________________________________
> Create a cool, new character for your Windows Live™ Messenger.
> http://go.microsoft.com/?linkid=9656621

_________________________________________________________________
We are your photos. Share us now with Windows Live Photos.
http://go.microsoft.com/?linkid=9666047

Re: How to detect End of file

by SilverSun :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The code works as expected in a terminal. Ctrl-D ends the stream and the loop.
2009/7/7 Naftoli Gugenhem <naftoligug@...>:

> In any case, try running your app in a real terminal and see if it behaves. If it does you'll know that netbeans is the "culprit," and if not then you know you have a problem with your code.
>
> -------------------------------------
> nope n<kingofadr1_@...> wrote:
>
>
>
>
> Hi,
>
> NetBeans uses GNU compilers and environment and in the GNU
> world Ctrl+Z stops the application, while end of stream is Ctrl+D.
>
>
>
>
>> Date: Mon, 6 Jul 2009 21:00:40 -0700
>> From: naftoligug@...
>> To: kingofadr1_@...; scala-user@...
>> Subject: Re: [scala-user] How to detect End of file
>>
>> I don't use netbeans, but why do you expect Ctrl-D to send an EOF? Does Netbeans do that for Java? Or is that what happens in a linux shell? (For windows command prompt it's Ctrl-Z)
>>
>> -------------------------------------
>> nope n<kingofadr1_@...> wrote:
>>
>>
>>
>>
>> Hi everyone,
>>
>>
>>
>> I have difficulties detecting the EOF
>> when I press ctrl-D at the netbeans output window.Here is the code I am using
>> for detecting eof when pressing ctrl-D:
>> def main(args: Array[String]) = {
>>     var line:String = ""
>>     do{
>>         line = readLine()
>>         println(line)
>>     }while(line != null)
>>   }
>>
>> When using Ctrl + D, the loop doesn't end and the code that follows the loop is not executed.
>> thank you,Francisco Perez
>>
>>
>>
>>
>>
>> _________________________________________________________________
>> Create a cool, new character for your Windows Live™ Messenger.
>> http://go.microsoft.com/?linkid=9656621
>
> _________________________________________________________________
> We are your photos. Share us now with Windows Live Photos.
> http://go.microsoft.com/?linkid=9666047
>

RE: How to detect End of file

by nope n :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Then i will just execute my code with the linux terminal and forget about netbeans. 
Thank you very much everyone for your help. 

> Date: Tue, 7 Jul 2009 10:57:47 +0200
> Subject: Re: [scala-user] How to detect End of file
> From: silbermilan@...
> To: naftoligug@...
> CC: kingofadr1_@...; scala-user@...
>
> The code works as expected in a terminal. Ctrl-D ends the stream and the loop.
> 2009/7/7 Naftoli Gugenhem <naftoligug@...>:
> > In any case, try running your app in a real terminal and see if it behaves. If it does you'll know that netbeans is the "culprit," and if not then you know you have a problem with your code.
> >
> > -------------------------------------
> > nope n<kingofadr1_@...> wrote:
> >
> >
> >
> >
> > Hi,
> >
> > NetBeans uses GNU compilers and environment and in the GNU
> > world Ctrl+Z stops the application, while end of stream is Ctrl+D.
> >
> >
> >
> >
> >> Date: Mon, 6 Jul 2009 21:00:40 -0700
> >> From: naftoligug@...
> >> To: kingofadr1_@...; scala-user@...
> >> Subject: Re: [scala-user] How to detect End of file
> >>
> >> I don't use netbeans, but why do you expect Ctrl-D to send an EOF? Does Netbeans do that for Java? Or is that what happens in a linux shell? (For windows command prompt it's Ctrl-Z)
> >>
> >> -------------------------------------
> >> nope n<kingofadr1_@...> wrote:
> >>
> >>
> >>
> >>
> >> Hi everyone,
> >>
> >>
> >>
> >> I have difficulties detecting the EOF
> >> when I press ctrl-D at the netbeans output window.Here is the code I am using
> >> for detecting eof when pressing ctrl-D:
> >> def main(args: Array[String]) = {
> >>     var line:String = ""
> >>     do{
> >>         line = readLine()
> >>         println(line)
> >>     }while(line != null)
> >>   }
> >>
> >> When using Ctrl + D, the loop doesn't end and the code that follows the loop is not executed.
> >> thank you,Francisco Perez
> >>
> >>
> >>
> >>
> >>
> >> _________________________________________________________________
> >> Create a cool, new character for your Windows Live™ Messenger.
> >> http://go.microsoft.com/?linkid=9656621
> >
> > _________________________________________________________________
> > We are your photos. Share us now with Windows Live Photos.
> > http://go.microsoft.com/?linkid=9666047
> >


Windows Live helps you keep up with all your friends, in one place.