--- /dev/null
+/*
+ * str.c
+ *
+ * Created on: Feb 14, 2011
+ * Author: lamikr
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+char *get_as_hex_str(const char *byte_arr, int byte_count) {
+ int ii;
+ char *ret_val;
+ char item[5];
+
+ ret_val = NULL;
+ if ((byte_arr != NULL) &&
+ (byte_count > 0)) {
+ ret_val = malloc(5 * byte_count);
+ for (ii = 0; ii < byte_count; ii++) {
+ if (ii == 0) {
+ snprintf(ret_val, 5, "0x%02x", byte_arr[ii]);
+ }
+ else {
+ snprintf(item, 5, "0x%02x", byte_arr[ii]);
+ strcat(ret_val, item);
+ }
+ if (ii < (byte_count - 1)) {
+ strcat(ret_val, " ");
+ }
+ }
+ }
+ return ret_val;
+}
--- /dev/null
+/*
+ * str_util.h
+ *
+ * Created on: Feb 14, 2011
+ * Author: lamikr
+ */
+
+#ifndef STR_UTIL_H_
+#define STR_UTIL_H_
+
+char *get_as_hex_str(const char *byte_arr, int byte_count);
+
+#endif /* STR_UTIL_H_ */