AnsweredAssumed Answered

What's wrong with the function fopen?

Question asked by cuckoo on Mar 22, 2016
Latest reply on Mar 29, 2016 by Kader.M

I used the function fopen to write a program under visualDSP++ environment and run it on ADSP21469.The program is very simple,as following:


/*****************************************************************************
* test.c
*****************************************************************************/
#define INPUT_FILE_NAME "H000a.wav"

#include <stdio.h>

int wavFileReadOpen(char *fileName)
{
FILE* fp = NULL;

if ((fp = fopen(fileName, "rb")) == NULL)
    {
        return -1;
    }

    return 0;

}

 

int main( void )
{
int open_flag = 0;
int test = 0;
    if (wavFileReadOpen(INPUT_FILE_NAME) != 0)
    {
        open_flag = 0;
    }
    else
    {
     open_flag = 1;
    }
   
  
test = 1;
return 0;
}

 

But no matter if file "H000a.wav" exists,function fopen always can't return NULL. What's wrong with it? Thank you!

Outcomes