Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Console.Readline - Newbie

Status
Not open for further replies.

hisheeraz

Programmer
Joined
Mar 24, 2003
Messages
28
Location
AU
Hello
i have this confussion here with the Console.ReadLIne i am trying to read keyboard and then displaying the keyboard entry to the console.

first line is working fine as it has been re written from a book but when i try to implement the other way (Line3) then i am getting error. i was wondering that if there is any other way of reading line from the input buffer.

i remember in c++ i was doing something like
Code:
{
cout >> "enter signal: ";
cin << signal; // where signal is a string

is there something similar to that in C# that i can read the string entered in the above way

Code:
{
Line1     Console.WriteLine("Enter some Signal: ");
Line2     //Signal = Console.ReadLine();
     // th above code is working without any problem
     // if i remove the '//' of the second line but when
     // i try to convert the second line of code 
     // to then third line of code then the problem occures 
     // and i get error
Line3     Console.ReadLine(Signal);

     Console.WriteLine("You entered: {0}\n", Signal);
}

I think i have made it clear enough to understand still if there is any confussion then please dono hesitate to ask question.



§ Rented Lips §
----------------
Begning To Learn
----------------
 
The read line function has no version that takes any parameters. Console.ReadLine(Signal); will fail to compile. What is wrong with Signal = Console.ReadLine(); anyway?
 
no wrong with that just thinking if there could be a better way...or perhaps it is a better way...i just had to quit my c++ habit
cheers!

§ Rented Lips §
----------------
Begning To Learn
----------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top