Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   help needed with streams (http://www.go4expert.com/forums/help-streams-t9682/)

tootypegs 2Apr2008 01:41

help needed with streams
hello, i am completelt stuck and i have no idea how to proceed and hoping that you guys may help. using memcmp i loop through my file finding every instance of a search criteria and return its byte position in 'pos'.

Everytime i get a return for pos, i want to start at that byte and stream the data into another file until i hit another search criteria. An example of my file could be

blahblahblahblahblahblahSTART datadatadatadatadatadatadatadata STOPblahblahblahblahblahblahblahblahblahblahblahbl ahblahblahblah
blahblahblahblahblahblahblahblahblah START datadatadatadatadatadatadatadata STOP blah

so far i loop through my file and return the byte position of each start fine. Could anyone help me to contruct a stream that starts at this position and streams the data until it reaches the end criteria

I am using memcmp because the end criteria for each stop position is a hex string
0xFF, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00

i would be EXTREMELY greatful for any help and can post the code i have if it will be of help?

All times are GMT +5.5. The time now is 17:28.