以下是引用cycchina在2007-10-23 11:23:54的发言:
#include <windows.h>
#include <stdio.h>
#include <process.h>
#include <stdlib.h>
#define ENV_VAR_STRING_COUNT (sizeof(envVarStrings)/sizeof(TCHAR*))
#define INFO_BUFFER_SIZE 32767
char *Get_system(char); //声明的函数参数与定义不同,而且返回类型也不同
char Get_system()
{
char *p;
TCHAR infoBuf[INFO_BUFFER_SIZE];
DWORD bufCharCount = INFO_BUFFER_SIZE;
p="GetSystemDirectory( infoBuf, INFO_BUFFER_SIZE )";
return p;
}
void main()
{
char *g=Get_system(char);//有这样调用的吗
printf( "%s",g);
}
虽然我不知道你要做什么,我只把改成的放在下面,你要的功能自己添吧.
#include <windows.h>
#include <stdio.h>
#include <process.h>
#include <stdlib.h>
#define ENV_VAR_STRING_COUNT (sizeof(envVarStrings)/sizeof(TCHAR*))
#define INFO_BUFFER_SIZE 32767
char *Get_system()
{
char *p;
TCHAR infoBuf[INFO_BUFFER_SIZE];
DWORD bufCharCount = INFO_BUFFER_SIZE;
p="GetSystemDirectory( infoBuf, INFO_BUFFER_SIZE )";
return p;
}
int main()
{
char *g=Get_system();
printf( "%s",g);
return 0;
}