Convert uint8 to string

Hi, i'm trying to convert a uint8 to a string but can't figure out how to do it.

I want the ID of an RFID card read in to a variable and stored as a string. I can read in the ID of the card as 0x01 0x02 0x03 0x04 0x05 0x06 0x07 but want to record this to a csv file in the format 01020304050607.

I've copied in some code below that i've got working up to this point...

uint8_t success;
  uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 };  // Buffer to store the returned UID
  uint8_t uidLength;                        // Length of the UID (4 or 7 bytes depending on ISO14443A card type)
  Serial.println("1.2");  
  // Wait for an ISO14443A type cards (Mifare, etc.).  When one is found
  // 'uid' will be populated with the UID, and uidLength will indicate
  // if the uid is 4 bytes (Mifare Classic) or 7 bytes (Mifare Ultralight)
  success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength);
  Serial.println("1.3");
  if (success) {
    // Display some basic information about the card
    Serial.println("Found an ISO14443A card");
    Serial.print("  UID Length: ");Serial.print(uidLength, DEC);Serial.println(" bytes");
    Serial.print("  UID Value: ");
    nfc.PrintHex(uid, uidLength);
    Serial.println("");
    
    IPAddress destinationIP(192, 168, 10, 1);  // Address of target machine
    unsigned int destinationPort = 6000;      // Port to send to
    
    char rfiduid = uid;
    
    // send a message to Processing, to the IP address and port that sent us the packet we received
    Udp.beginPacket(destinationIP,destinationPort);
    Udp.write(rfiduid);
    Udp.endPacket();

Where I declare the char rfiduid is where I expect the conversion to happen, just not sure how to actually convert it!

With sprintf it's easy:

char rfiduid[15];

sprintf( rfiduid, "%02X%02X%02X%02X%02X%02X%02X", uid[0], uid[1], uid[2], uid[3], uid[4], uid[5], uid[6] );

Maybe you want to do something like this instead:

char rfiduid[15];

for ( uint8_t i = 0; i < uidLength; i++ )
{
    sprintf( rfiduid, "%s%02X", rfiduid, uid[i] );
}

Is there a reason why you want to make the 7 bytes into 14-byte string to store on the card?

Thanks for the tip guix, will give it a try and let you know how I get on! Just about to get my head back in to it now.

econjack, I wanted to store the string in a single cell of a csv so it can be read out easily for other applications like cross referencing if the number is stored in the database, or so it can be seen if the csv were to be opened in a spreadsheet format. I won't be storing any data on the cards themselves.

Thanks guys, that sprintf function works like a charm!