I don't think it's wise what you do there:
1. I believe that what getenv() returns is a pointer to the actual entry in its table. I would never append anything to this if I were you, as what you're doing is changing the table entry (which probably leads to access violations, since your' probably writing beyond the buffer). Better copy the string into a new buffer and append from there.
2. You cannot just strcat one char* to the other. Your destination buffer needs to be large enough, or you'll cause access violations.
You'd better do it like this:
_TCHAR szPath[MAX_PATH];
if(GetTempPath(MAX_PATH, szPath) && PathAppend(szPath, _T("data1.txt"

)) {
do your stuff;
}
The beauty of PathAppend is, that it's wise enough to see whether or not backslashes need to be added. You'll have to link to shlwapi.lib to use it though.
But if you want to stick to getenv(), I'd od it like this:
_TCHAR* szEnv = _tgetenv(_T("temp"

);
_TCHAR* szPath = new _TCHAR[_tcsclen(szEnv) + 11];
_tcscpy(szPath, szEnv);
_tcscat(szPath, _T("\\data1.txt"

));
...
...
delete[] szPath;
Greetings,
Rick