Welcome to Dream.In.Code
Become a C# Expert!

Join 136,927 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 1,835 people online right now. Registration is fast and FREE... Join Now!




read bits from a file and manipulate them

 
Reply to this topicStart new topic

read bits from a file and manipulate them

thejasper
3 Apr, 2008 - 10:15 AM
Post #1

New D.I.C Head
*

Joined: 2 Nov, 2007
Posts: 28


My Contributions
Hello all

Sorry but I haven't got any code yet because I first have to know it is possible (didn't find much interesting on google). My problem: reading bits from a file and manipulate them. So I have to get the 0's and the 1's from a file in an array or something, adjust them and make a file again with them. Is this possible? You guys could help me with some example code or some useful function names. I would really appreciate that smile.gif

thx
Jasper
User is offlineProfile CardPM
+Quote Post

zakary
RE: Read Bits From A File And Manipulate Them
3 Apr, 2008 - 11:44 AM
Post #2

D.I.C Regular
Group Icon

Joined: 15 Feb, 2005
Posts: 406



Thanked: 6 times
Dream Kudos: 175
My Contributions
System.IO.StreamReader and System.IO.StreamWriter or two good places to start once you read the file in you can manipulate the data and then write it back to the file
User is offlineProfile CardPM
+Quote Post

thejasper
RE: Read Bits From A File And Manipulate Them
3 Apr, 2008 - 12:17 PM
Post #3

New D.I.C Head
*

Joined: 2 Nov, 2007
Posts: 28


My Contributions
reading the file isn't the problem, but I want the bits from the file, for example from a zip archive.
User is offlineProfile CardPM
+Quote Post

zakary
RE: Read Bits From A File And Manipulate Them
4 Apr, 2008 - 03:52 AM
Post #4

D.I.C Regular
Group Icon

Joined: 15 Feb, 2005
Posts: 406



Thanked: 6 times
Dream Kudos: 175
My Contributions
So you want to take a file out of a zip or rar file edit it and then place the newly edited file back in the zip or rar

This post has been edited by zakary: 4 Apr, 2008 - 05:38 AM
User is offlineProfile CardPM
+Quote Post

thejasper
RE: Read Bits From A File And Manipulate Them
4 Apr, 2008 - 06:32 AM
Post #5

New D.I.C Head
*

Joined: 2 Nov, 2007
Posts: 28


My Contributions
maybe the zip archive example wasn't good. but.. every file is build of bytes, you can see that when you check the filesize. Well.. I want to manipulate those bytes no mather from what file. I hope that's possible

for example if the first byte is: 10010010 i want to change this to 01101101
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/3/08 10:27PM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month