String problem with SdFat library

Hey guys i am working on a project which should read the rfid tag’s uid and then open the file which named as the uid but there is a problem

file = + "txt");

when i use this line of code there is a error message says i can not use String in here i tried to convert String to integer with this line of code

int uid1 = String(uid);

but this did not worked either what should i do and if it’s gonna help here is my full code (some variable names are in turkish cause im from turkey)

#include <SdFat.h>
#include <SPI.h>
#include <MFRC522.h>
SdFat SD;
File dosya;
int val[3];
int as1;
int as2;
int as3;
int as4;
int hak;
String uid;
#define SS_PIN 10
#define RST_PIN 9
#define SDSS_PIN 4
MFRC522 mfrc522(SS_PIN, RST_PIN);  // Create MFRC522 instance.
byte cardPresent;

void setup() {
  Serial.begin(9600); // Initialize serial communications with the PC
  SPI.begin();      // Init SPI bus
  mfrc522.PCD_Init(); // Init MFRC522 card
// Serial.println("Ready!");

void loop() {
  // Look for new cards
  if ( ! mfrc522.PICC_IsNewCardPresent()) {

// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial()) {
//Serial.print("Card UID:");
        for (byte i = 0; i < mfrc522.uid.size; i++) {
                val[i] = (mfrc522.uid.uidByte[i]);
        String as1 = String(val[0]);
        String as2 = String(val[1]);
        String as3 = String(val[2]);
        String as4 = String(val[3]);
        uid = as1 + as2 + as3 + as4;
        if (String(uid) == "18204122133"){
        dosya = + "txt");
        if(dosya) {
            hak = Serial.write(;

The open method takes a string (null terminated character array or c-string NOT a String object) as the filename. Look in the library's header (.h) file to see the function definitions and what type of arguments that the function accepts.

cstring functions

String.toCharArray() You might want to read this whole linked topic as it explains why Strings are not so good to use with Arduino.

In the future, please post the entire text of an error that is giving you trouble. The text can include valuable information.