I need to get the path of %APPDATA% in my c program, to save a file in
%APPDATA%\myprogram\
How can I do that ?
You should be able to get that information through getenv
, here is an example.
#include<stdio.h>
#include<stdlib.h>
int main ()
{
char * app_data;
app_data= getenv ("APPDATA");
if (app_data!=NULL)
printf ("The appdata path is: %s",app_data);
return 0;
}