Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9171647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:11:30+00:00 2026-06-17T16:11:30+00:00

I am trying to open up a file that I calculate the name into

  • 0

I am trying to open up a file that I calculate the name into a string. However, it is just giving me compile errors as shown.

for(int i=1;;i++)
{
   String temp = "data";
   temp.concat(i);
   temp.concat(".csv");
   if(!SD.exists(temp))//no matching function for call to sdclass::exists(String&)
   {
      datur = SD.open(temp,FILE_WRITE);
   }
}

I am a java person, so I don’t see why this isn’t working. I tried a few string object methods but none seem to have worked. I am a bit new at arduino programming but I understand java much better. The point of this for loop is to make a new file each time the arduino reboots.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:11:30+00:00Added an answer on June 17, 2026 at 4:11 pm

    SD.open expects a character array instead of a String, you need to convert it using the toCharArray method first. Try

      char filename[temp.length()+1];
      temp.toCharArray(filename, sizeof(filename));
      if(!SD.exists(filename)) { 
       ...
      }
    

    Completed Code:

    for(int i=1;;i++)
    {
       String temp = "data";
       temp.concat(i);
       temp.concat(".csv");
       char filename[temp.length()+1];
       temp.toCharArray(filename, sizeof(filename));
       if(!SD.exists(filename))
       {
          datur = SD.open(filename,FILE_WRITE);
          break;
       }
    }
    

    You will find a number of functions take char arrays instead of strings.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Specifically I am trying to open a file from SharePoint, but it's really just
I'm trying to open an encrypted file that will store a list of information,
I'm trying to open a word document and just extract all the text that
I am trying to open a resx file that is a resource in my
I'm trying to open a file in GAE that was retrieved using urlfetch() .
I am trying to open file in function that loads arguments and then save
I'm trying to open a file that doesn't exist with this line: x =
I am trying to open a Binary file that I plan on converting to
I'm trying to open a file that includes some data in a web directory
Am trying to open a .xap file that I created from my computer on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.