SD error (hijack)

when i used

#include <SPI.h>
//#include <SD.h>
#include <SdFat.h>
extern SdFat SD;

i get error msg
Error compiling for board Arduino/Genuino Uno.

SixtoD:
when i used

#include <SPI.h>

//#include <SD.h>
#include <SdFat.h>
extern SdFat SD;



i get error msg
Error compiling for board Arduino/Genuino Uno.

But you couldn't be bothered to post the code or the error message?

Is that approach working for you?

#include <SPI.h>
//#include <SD.h>
#include <SdFat.h>
extern SdFat SD;



File myFile;
File tempFile;
char cr;
void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
Serial.print("Initializing SD card...");

  if (!SD.begin(4)) {
    Serial.println("initialization failed!");
    while (1);
  }
  Serial.println("initialization done.");
  // re-open the file for reading:
  myFile = SD.open("test.txt");
  tempFile = SD.open("temp.txt", O_WRITE | O_CREAT | O_TRUNC);

// skipped/blocked the first Line OPEN
      bool firstLine = true;
while (myFile.available()) {
  int c = myFile.read();
  if (firstLine) {
    if (c == '\n') {
      firstLine = false;
    }
  } else {
 
  Serial.write(c);
  tempFile.write(c);
  }

}
myFile.close();
tempFile.close();
 

    
// skipped/blocked the first Line CLOSED

loop();



  } //if(myFile) closing
  else {
    // if the file didn't open, print an error:
    Serial.println("error opening test.txt");
  }
}

void loop() {
// nothing happens after setup
}

just wanted to save all output to temp.txt, then i will delete the test.txt and rename the temp.txt to test..txt

SixtoD:
just wanted to save all output to temp.txt, then i will delete the test.txt and rename the temp.txt to test..txt

I don't see like you were doing such thing.

Lucario448:
I don't see like you were doing such thing.

just want to know how to use hehe

#include <SdFat.h>
extern SdFat SD;

I want to rename the temp.txt,
Ive search in this forum, they all say that the SdFat is the only solution to rename a file
but im getting an error msg "Error compiling for board Arduino/Genuino Uno."

but im getting an error msg "Error compiling for board Arduino/Genuino Uno."

That message is the LAST message. We need to see your complete code AND ALL of the error messages.

You also need to explain why you have added the extern statement to the code.

SixtoD:

#include <SPI.h>

//#include <SD.h>
#include <SdFat.h>
extern SdFat SD;

File myFile;
File tempFile;
char cr;
void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
Serial.print("Initializing SD card...");

if (!SD.begin(4)) {
    Serial.println("initialization failed!");
    while (1);
  }
  Serial.println("initialization done.");
  // re-open the file for reading:
  myFile = SD.open("test.txt");
  tempFile = SD.open("temp.txt", O_WRITE | O_CREAT | O_TRUNC);

// skipped/blocked the first Line OPEN
      bool firstLine = true;
while (myFile.available()) {
  int c = myFile.read();
  if (firstLine) {
    if (c == '\n') {
      firstLine = false;
    }
  } else {

Serial.write(c);
  tempFile.write(c);
  }

}
myFile.close();
tempFile.close();

// skipped/blocked the first Line CLOSED

loop();

} //if(myFile) closing
  else {
    // if the file didn't open, print an error:
    Serial.println("error opening test.txt");
  }
}

void loop() {
// nothing happens after setup
}




just wanted to save all output to temp.txt, then i will delete the test.txt and rename the temp.txt to test..txt

this is my whole code

and im getting this error msg when I used the extern SdFat
Error compiling for board Arduino/Genuino Uno."

and im getting this error msg when I used the extern SdFat

That is not the only message, though.

sorry, i thought thats the only error message.

Desktop\blahblah\skip_first_line_and_write_to_temp_file__experiment\skip_first_line_and_write_to_temp_file__experiment.ino:3:19: fatal error: SdFat.h: No such file or directory

 #include <SdFat.h>

                   ^

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Uno.

The library's folder isn't placed in the correct location. This locaton is: "Documents" folder>Arduino>libraries