I can't believe I've never noticed this before (because everything appeared to be working fine for months), but apparently mIRC does not set the working directory to the mirc.ini location?

Is there a way to avoid using full paths? A function I can call which will return what mIRC thinks is the working directory? Can mIRC call SetCurrentDirectory or may that break existing libraries?

Code:
#include <stdio.h>
#include <direct.h>

char cCurrentPath[FILENAME_MAX];
 _getcwd(cCurrentPath, sizeof(cCurrentPath));

FILE *file;
int error = _tfopen_s(&file, TEXT("encrypted"), TEXT("wb"));