Sir,

I have got a series of float values coming and i want to store these values
into a file in such a way that when one value is written in the file then it
goes to next line and writes other line.(like using of \n ; how can i do it.i
tried to use stream reader but it write file in UT8 type .i tried to used
binary reader but it is not working.

give me some alternative for it.

so that whatever the value come in my flaot variable is written in the file.

wating for your reply eagerly.

Regards

Naveen

Re: need help on readers and writes....... by Rob

Rob
Tue Sep 27 08:38:04 CDT 2005

Naveen koul wrote:
> Sir,
>
> I have got a series of float values coming and i want to store these values
> into a file in such a way that when one value is written in the file then it
> goes to next line and writes other line.(like using of \n ; how can i do it.i
> tried to use stream reader but it write file in UT8 type .i tried to used
> binary reader but it is not working.
>
> give me some alternative for it.
>
> so that whatever the value come in my flaot variable is written in the file.
>
> wating for your reply eagerly.
>
> Regards
>
> Naveen

Try something like this?:

float[] f = new float[]{1,2,3,4,5,6,7,8,9,10};

System.IO.FileStream fs = new System.IO.FileStream(@"C:\output.txt",
System.IO.FileMode.Create);

for(int i=0; i < f.Length; i++)
{
byte[] b = new System.Text.ASCIIEncoding().GetBytes(f[i].ToString()
+ "\r\n");
fs.Write(b, 0, b.Length );
}

fs.Close();

You could also use the TextWriter, which has a NewLine() method.

--
Rob Schieber

Re: need help on readers and writes....... by Tiberiu

Tiberiu
Tue Sep 27 12:37:13 CDT 2005

First of all, if you want to write to a file you will need a writer, like
StreamWriter, second, StreamWriter has a method called WriteLine which takes
a float or a double parameter, and this I think will help you solve the
problem.

Tibi

"Naveen koul" <Naveenkoul@discussions.microsoft.com> wrote in message
news:5F9BEEC5-6305-476B-97C9-0BA5F856AFC5@microsoft.com...
> Sir,
>
> I have got a series of float values coming and i want to store these
> values
> into a file in such a way that when one value is written in the file then
> it
> goes to next line and writes other line.(like using of \n ; how can i do
> it.i
> tried to use stream reader but it write file in UT8 type .i tried to used
> binary reader but it is not working.
>
> give me some alternative for it.
>
> so that whatever the value come in my flaot variable is written in the
> file.
>
> wating for your reply eagerly.
>
> Regards
>
> Naveen