helloooooooooooooooooo its urgent
-
hi friends, please can anyway one help me if i can modify a file. i mean delete some sentences from it and save it without writing its content to another file and then overwrite it?
emma :)
Well u can use..
System.IO.File.ReadAllLines OR System.IO.File.ReadAllText
then Modify string and then write usingSystem.IO.File.WriteAllLines OR System.IO.File.WriteAllText
Bt keep in mind this will overwrite the file.
"If our Mind can, the Program can !!" ≡ ░Ŗǿђầŋ٭ ≡
-
hi friends, please can anyway one help me if i can modify a file. i mean delete some sentences from it and save it without writing its content to another file and then overwrite it?
emma :)
imanos wrote:
helloooooooooooooooooo its urgent
That sort of subject is not helpful, it doesn't describe your problem at all.
imanos wrote:
i mean delete some sentences from it and save it without writing its content to another file and then overwrite it?
To do this, use System.IO.File.ReadAllText to read the file, modify it in memory, then use File.WriteAllText to save it again.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
imanos wrote:
helloooooooooooooooooo its urgent
That sort of subject is not helpful, it doesn't describe your problem at all.
imanos wrote:
i mean delete some sentences from it and save it without writing its content to another file and then overwrite it?
To do this, use System.IO.File.ReadAllText to read the file, modify it in memory, then use File.WriteAllText to save it again.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
Christian Graus wrote:
imanos wrote: helloooooooooooooooooo its urgent That sort of subject is not helpful, it doesn't describe your problem at all.
No it doesn't. Even if he says it outside a Port-a-Potty with a guy taking a long time inside :laugh:
-
Well u can use..
System.IO.File.ReadAllLines OR System.IO.File.ReadAllText
then Modify string and then write usingSystem.IO.File.WriteAllLines OR System.IO.File.WriteAllText
Bt keep in mind this will overwrite the file.
"If our Mind can, the Program can !!" ≡ ░Ŗǿђầŋ٭ ≡
-
Christian Graus wrote:
imanos wrote: helloooooooooooooooooo its urgent That sort of subject is not helpful, it doesn't describe your problem at all.
No it doesn't. Even if he says it outside a Port-a-Potty with a guy taking a long time inside :laugh:
well thanks, ill clear it, i have 2 files and i want to delete the words in the first one from the second one knowing that i don't want to create new file and write the old one again without the unwanted words i.e. i want to modify the file and save it
emma :)
-
well thanks, ill clear it, i have 2 files and i want to delete the words in the first one from the second one knowing that i don't want to create new file and write the old one again without the unwanted words i.e. i want to modify the file and save it
emma :)
imanos wrote:
i don't want to create new file and write the old one again
Why not? Just create a temporary file with the new list of wanted words, rename the original first file, and rename the temporary file to the original name of the first file...