This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- follow up to the code
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
‎Oct 14, 2009
08:33 AM
InstallScript Open File error
I need to create a file and write to it, while installation.
I tried the createfile and it kept giving me -1 error.
So I now have my file created before and copy it to the destination and try to use OpenFile and still get -1 status. (what do I need to do before opening or creating).
I am doing this in the OnBegin routine (so not much has occured prior to these calls).
appreciate your help.
thank you very much.
I tried the createfile and it kept giving me -1 error.
So I now have my file created before and copy it to the destination and try to use OpenFile and still get -1 status. (what do I need to do before opening or creating).
I am doing this in the OnBegin routine (so not much has occured prior to these calls).
appreciate your help.
thank you very much.
(5) Replies
‎Oct 14, 2009
08:51 AM
How about posting your code?
‎Oct 14, 2009
09:00 AM
here is my code
STRING srcpath, dstpath, filename;
NUMBER nResult, nvFileHandle;
filename = "sample.txt";
dstpath = "c:\temp";
srcpath = SRCDISK + "\\Data";
XCopyFile(srcpath, dstpath, COMP_NORMAL);
nResult = OpenFile(nvFileHandle, dstpath, filename);
(XCopyFile is successful, the file is in the temp folder).
nResult is always -1.
STRING srcpath, dstpath, filename;
NUMBER nResult, nvFileHandle;
filename = "sample.txt";
dstpath = "c:\temp";
srcpath = SRCDISK + "\\Data";
XCopyFile(srcpath, dstpath, COMP_NORMAL);
nResult = OpenFile(nvFileHandle, dstpath, filename);
(XCopyFile is successful, the file is in the temp folder).
nResult is always -1.
‎Oct 14, 2009
09:05 AM
the XCopyfile section (looks incorrect in the extract I posted.
it should really be -
copy the entire folder (I have functions that do it)
here is what exactly happens.
filetocopy = srcpath + "\\" + filename;
XCopyFile(filetocopy, dspath, COMP_NORMAL);
it should really be -
copy the entire folder (I have functions that do it)
here is what exactly happens.
filetocopy = srcpath + "\\" + filename;
XCopyFile(filetocopy, dspath, COMP_NORMAL);
‎Oct 14, 2009
09:15 AM
The problem may be in the dstpath spec. In a quoted string you need to double up the backslashes (as you did prior to "Data").
You might try changing
to
You might try changing
filename = "sample.txt";
dstpath = "c:\temp";
srcpath = SRCDISK + "\\Data";
to
filename = "sample.txt";
dstpath = "c:\\temp";
srcpath = SRCDISK + "\\Data"; // or srcpath = SRCDISK ^ "Data";
‎Oct 14, 2009
09:24 AM
Dan,
thanks for the pointer.
I just checked, my code is correct in the project (my bad on typing it here for the forum) - you see I cannot do a cut and paste, they are on 2 different (disconnected servers).
any other suggestions?
thanks very much.
thanks for the pointer.
I just checked, my code is correct in the project (my bad on typing it here for the forum) - you see I cannot do a cut and paste, they are on 2 different (disconnected servers).
any other suggestions?
thanks very much.