Can somebody tell me the file read and write syntax. I found the following code on the net. but didnt get that.

fs2.Read(fs2Content, 0, (int)fs2.Length);
fs1.Write(fs2Content, 0, (int)fs2.Length);

what exactly first, second and third arguement will do in above statements. pls give me some details regarding this.

Thanks

Recommended Answers

All 7 Replies

Assuming that fs1 and fs2 are streams... go take a look at the helpfile.

// reading the contetnt of file
StreamReader sr = new StreamReader(Sting Path);
textbox1.text=sr.ReadToEnd();
sr.Close();

//writing to the file

StreamWriter sw = new StreamWriter(Sting Path);
sw.WriteToEnd();
sw.Close();

OK BlackSun your attempt is honorable but totally beside the question. ( And please drop your textbox fumbling!)

Indianblues just needs to follow the advice of LizR here: open the helpfile and look for StreamReader Read. If Indianblues has no helpfile he can google for help or come back here.

Thank you very much.
Its working

u welcome man

not sure if the is the correct fourm, but need some help.
I have a file 77D7.txt, need to read it and reformate and create a new file. There are 4 field seperated by "," in each line. Would someone please help me get started.

Thanks very much

Please open another thread and ask there, it's solved one :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.