I have this c module:
#include "stdafx.h"
#include "targetver.h"
#include "libavutil\mathematics.h"
#include "libavcodec\avcodec.h"
FILE fileName;
I did File fileName;
This i have init function:
void init(const char *filename)
{
fileName = filename;
avcodec_register_all();
printf("Encode video file %s\n", fileName);
So i did fileName = filename; The reason i did is that i have another function i did called start():
void start()
{
/* open it */
if (avcodec_open2(c, codec, NULL) < 0) {
fprintf(stderr, "Could not open codec\n");
exit(1);
}
// f = fopen(filename, "wb");
errn = fopen_s(&f,fileName, "wb");
if (!f) {
fprintf(stderr, "Could not open %s\n", fileName);
exit(1);
}
}
And in start i had filename but it didn't find it so i wanted to use fileName instead. But i'm getting now few errors:
On this line: fileName = filename; on the = symbol i'm getting red line error:
Error 1 error C2440: '=' : cannot convert from 'const char *' to 'FILE'
Then on this line: errn = fopen_s(&f,fileName, "wb") On the fileName i'm getting:
Error 2 error C2065: 'filename' : undeclared identifier
Same error number 2 on this line on the fileName: fprintf(stderr, "Could not open %s\n", fileName);
Then another error on the fileName = filename:
6 IntelliSense: no operator "=" matches these operands
operand types are: FILE = const char *
Last error: 7 IntelliSense: no suitable conversion function from "FILE" to "const char *" exists
All i wanted to do is to declare global fileName variable to use it in all places.