tags:

views:

70

answers:

1

hi

I'm trying to read only the strings from an image file. I was able to successfully read all the strings in the image file using java. I wrapped the inputstream into a filereaderstream which is again wrapped inside of a bufferereader. so now i can extract all the strings from the image file (like xmp tags and exif, tiff tags etc) ..

how do i accomplish the same thing using c.

Thanks

+1  A: 

If you are using unix based OS, you can use the (unix, not C) command strings.

Moron
wow.. the command line tool is great. but unfortunately i'm looking for something which can be done programmatically in C because i've other manipulations to do.
Raja
Can't you just pipe the output of strings to your tool which then does the other things you need?
Moron
the problem with strings is that its giving out all the printable characters. now i only need the characters starting from say "<xmpmeta" and ending with "</xmpmeta>".I'm right now reading the available options in the man page... let me see if there's anything in there
Raja
to be more specific I'm looking for strings encoded in UTF8
Raja
You can use grep/sed/awk. btw, UTF8 is just a scheme of encoding, which you use to interpret the data. You need to _know_ it before hand, unless the data has the meta-data about the encoding mixed in. So looking for strings encoded in UTF8 does not seem to make much sense.
Moron