Click here to Skip to main content
15,665,229 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Friends please as soon as possible please tell me now how to create temporary file in VC++ at run time.

I have written the code but sorry I can't mention the code here I am getting the error
'FileSecureHotfolder::IAddClass::GetHotFolderID' : cannot convert parameter 1 from 'const char [47]' to 'BSTR'

c:\sathish\irm doc protector\sampledocprotector\sampleprotector.cpp 1151 SampleDocProtector

I have got some answer also but I don't want in that format I want that if user click on the button one temporary file should be created please help :(( :(( :((
and get stored in the file which I have given the path.

Please help me with the code to create temp file please its really very urgent

Thanks in Advance :rose::rose:
Updated 14-Oct-10 4:32am

The error means that the types are simply incompatible. This article might be interesting to you and can help you out:

Guide to BSTR and C String Conversions[^]

Good luck!
Share this answer
You may use the CRT function _mktemp, see the sample in the _mktemp function help page[^].
Share this answer
aayu 13-Oct-10 6:24am    
CPallini 13-Oct-10 6:25am    
aayu 13-Oct-10 7:16am    
i am just debugging the code it is giving me template as error which i have solve but i don't want in this format it is creating the file at a same time where in i need on the click of the user one temp file should be created.
There are windows api functions could help you:
GetTempPath and GetTempFileName

See this:
Creating and Using a Temporary File
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900