Why does this code get an access error on the result line: = Buffer in D2010, but not D7?
Something, I think, with UniCode, but the compiler does not generate any warnings.
Any suggestions for an elegant workaround?
Edit: Ouch: calling GetTempPath causes the stack to split, as evidenced by the fact that after the GetTempPath line the extension remains empty, but not before ... Yikes.
function GetTempPathAndFileName( const Extension: string): string; var Buffer: array[0..MAX_PATH] of Char; begin repeat GetTempPath(SizeOf(Buffer) - 1, Buffer); GetTempFileName(Buffer, '~', 0, Buffer); Result := Buffer;
delphi
RobertFrank
source share