tags:

views:

136

answers:

3

Who knows the freopen and scanf function functionality but in c# not in c???????

thanks

A: 

Filestream and Streamreader.

Femaref
+1  A: 

freopen does not have a direct parallel. You'd have to Close and then re-create a FileStream object to get similar behavior.

scanf and similar type-unsafe functions have been replaced with Parse methods, e.g., int.Parse. Your stdin stream is Console.In. You'll have to do your own delimiting from the input stream into a string, which can then be parsed into an integer.

Stephen Cleary
scanf is not for parse,it to,but its functionality is to read from stdin buffer
Daniel G. R.
`scanf` does parsing from `stdin`. In .NET, you'll need to read from `Console.In` and *then* do parsing.
Stephen Cleary
A: 

I doit like this, as you say:

StreamReader objReader = new StreamReader("input.txt");

String readed = "";

while(readed != null){
    readed = objReader.ReadLine();  
    System.out.println(readed);
}

using StreamReader then I can split it with ' ' to take each variable (in c will be scanf("%d%d%d",&v1,&v2,&v3))

thanks

Daniel G. R.
-1: `System.out.println` looks like Java, and this is C#
John Saunders