English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have stored words in the form of hex values in a text file. From a program i m trying check to whethr the word exists or nt.

ex:

i hav the hex values of words "Hello" "you" "many" "how" etc

given a sentence "Hello how are you? how many days are there in a week? " I wnt to chk whtr these words exist in the file and if thy exist replace thm with the offsets . hex value of each character is stored with spaces between thm. for ex: IN is atored as 49 4e. I tried using strstr() function..but its nt workg with hex..for string it works perfectly

2007-02-06 17:52:29 · 2 answers · asked by sreenanda 1 in Computers & Internet Programming & Design

2 answers

My approach would be to first read in your list and add the words to an internal array. For example, words[0]="Hello", words[1]="you", etc.

Then, if each work is delimited by a space, you would begin reading in the file (or read up to a space) and then compare what was read against your array of words. If found, output each hex character using printf("%h", wordChar) and then get another word. If it's not in the array, copy the input "word" into a string and then print out the string.

2007-02-06 18:22:14 · answer #1 · answered by BigRez 6 · 0 0

proper what you may do is examine contained in the report as char utilising in.get() then once you may form forged the nature to int cout <

2016-12-03 20:19:34 · answer #2 · answered by plyler 4 · 0 0

fedest.com, questions and answers