This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Issue with opening the file.

Hi,

I have written a code to open/create a text file in keil4 IDE, but not able to creat it, here is my code,

#include "inc/tm4c123gh6pm.h"
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>

FILE *f_Write = NULL;
char buf[512];

int main(void)
{ // here i tried by giving different paths by inserting USB(U:,U0:), SD card (M),
and also with default drive and flash drive.

f_Write = fopen("F:\\file4.txt","w");

if (!f_Write) return 1;

fclose(f_Write); return 0;
}

I have tried building the code with CCS compiler also, here file is created, but when i try to write some content it is not being written. If i read different file by opening it in read mode(manually by writing some content) both fgets and fgetc functions pointing to NULL and EOF at single reading.

I am not getting any errors but file operations are not being done in ccs, in keil file is not created, can anyone please help me out where i am going wrong.

Thanks & Regards,
Mamatha