Hi, I have a BlueprintFunctionLibrary I’m writing and some of the code I have is causing the editor to crash on startup.
I have a blueprint-friendly function that does nothing but call a constructor for a separate class and return it.
MyClass MyBlueprintFunction(FString filename) {
MyClass instance;
instance = MyClass(TCHAR_TO_ANSI(*filename));
return instance;
}
MyClass’ constructor tries to construct itself using information from the file provided.
In the constructor I have the following code:
MyClass(char *filename) {
FILE *file;
fopen_s(&file, filename, "rb"); // from stdio.h
... // (using the file)
}
This code compiles fine in Visual Studio 2015 for development editor. When I use the File* for any operations later in the function, the editor crashes when I start it up. If I remove all uses of the File* the editor does not crash. Some examples of my uses of the File* are as follows:
uint32_t width = 0, height = 0;
...
fread(&width, 1, sizeof(width), file);
fread(&height, 1, sizeof(height), file);
fclose(file);
Leaving any of these lines (except the first) in the function causes the editor to crash. Any ideas of what I might be doing wrong? Is this a bug?