the last byte and read in four more while keeping the last byte of the previous set in first place of the new set?
And if it is not ok then write out all five bytes to a file?
Thanks
the last byte and read in four more while keeping the last byte of the previous set in first place of the new set?
And if it is not ok then write out all five bytes to a file?
Thanks
How about you write that out in steps before you start trying to program it?
Quzah.
Hope is the first step on the road to disappointment.
I'm not sure how to.
I need to read in five bytes and look at the data if I come accross a certain symbol in hex only write out the first two or three or four keeping the remander for the buffer and refill the rest of the buffer.
Thanks
Last edited by Once-ler; 02-08-2012 at 03:42 AM.
If you can't plan out in words what steps you would need to do, then you have no hope of programming it. Think about it in simple abstract steps, not in actual code.
Quzah.
Hope is the first step on the road to disappointment.
If first byte = A & second byte = A but third byte != A then write out AA(whatever the value of the third byte), and read in three more bytes behind the leftovers.
If first byte !=A then write out the five bytes and read in five new fresh ones.
Last edited by Once-ler; 02-08-2012 at 05:36 AM.
Or how about this, I need to write a program that reads hex values from 4 bytes. If the values of the first one is ! A then output the 4 bytes to a file, If it ==A and the second byte == A but the tird byte != A then output the 3 bytes.
I'm sorry I don't really know how to explain it very good.
I am still a newbie.
The reason I didn't just start handing out code was because you need to learn how to describe in detail what you really need, and then to break those things into small tasks.Now, you have to break each of those steps into as many small tasks as you need to, so that each step you need to do is as clear as possible. Once you understand all of the steps, you can think about coding it.Code:open one file for reading, call it input open one file for writing, call it output while there is still stuff in the input file, do this: 1. Check for the appropriate bytes. 2. Write if we have a match. close both files
Quzah.
Hope is the first step on the road to disappointment.