|
-
Jul 1st, 2006, 11:40 AM
#1
Thread Starter
Fanatic Member
[2.0] How can I change bytes in a file?
Hello,
I am making a small encryption application and for that I want to change
bytes in my file.
how can I do this using c#?
thanks!
-
Jul 1st, 2006, 12:09 PM
#2
Re: [2.0] How can I change bytes in a file?
Create a FileStream object, either directly or through the File class, and then use it to read and/or write bytes to the disc file.
-
Jul 1st, 2006, 04:17 PM
#3
Re: [2.0] How can I change bytes in a file?
jmcilhinney has a great knowledge but doesn't like to give code samples unless it's very necessary, but I do
so here is how you can do it, just like he said:
Code:
FileStream fs=new FileStream(@"C:\myText.txt",FileMode.Open,FileAccess.ReadWrite);
while(fs.Position<fs.Length){
byte bf=fs.ReadByte();
//Do any encryption on the byte
fs.WriteByte(bf);
}
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Jul 2nd, 2006, 03:39 PM
#4
Thread Starter
Fanatic Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|