This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/MSP430F5438A: fopen - fail to open name file in runtime

Part Number: MSP430F5438A


Tool/software: TI C/C++ Compiler

Hello,
I use the msp430 with CCs 5.3.
and work with the msp4305438a.


the problem:
the name of the file to open is unknown in compile time, just in run time.
so. in case i use the statement:

//////
char FileToOpen {50] = {0};
... read the FileToOpen from the ...
fin = fopen ( (const char *)FileToOpen, "r");
fin is return NULL, so it fail. ( why??)

but if i write :
fin = fopen ( "...\fileIn.txt", "r");
the fopen function is succeded.

is anyone know the reason while in the first case : fopen ( (const char *)FileToOpen, "r") ,
the function is fail

Thanks.

**Attention** This is a public forum