I need to convert array of char to hex one char at a time ,
I tried to use sprintf,but it did not work.


Are you trying to display the character's value as a hexadecimal?

#include <iostream>

int main()
  unsigned char myc = 'o';
  std::cout << (int)myc << std::endl;
  std::cout << std::hex << (int)myc << std::endl;
  std::cout << std::oct << (int)myc << std::endl;
  return 0;

actully no , I put the cout<< to test the code , I need to calculate the number of string in all files that is of length 1 , 2,......,50,then write the result to another file

the problem is that every thing is working 100% for the first file only

Sorry I posted tow thread togother I thought you are talking about the other one, anyway thank you for your answer