fork download
  1. #include <string.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. char* bin(const char* name )
  6. {
  7. char buffer[10064] = { '\0' };
  8. buffer[0] = ' ';
  9. char* pbuffer = buffer;
  10. int len = strlen( name );
  11.  
  12. for( int i = 0; i < len; i++ )
  13. {
  14. sprintf( pbuffer, "%02X", name[i] );
  15. pbuffer += 2;
  16. }
  17.  
  18. return strdup( buffer );
  19. }
  20.  
  21. int main()
  22. {
  23. char* c = bin("ciao");
  24. printf("%s\n", c );
  25. free( c );
  26. return 0;
  27. }
Success #stdin #stdout 0s 2856KB
stdin
Standard input is empty
stdout
6369616F