![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Open a File present in Windows Directory Topic Summary: Open a File present in Windows Directory Created On: 24-Sep-2008 06:58 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Hello All,
I would like to open a file which is existing in a windows directory path. For example, if I want to open C:\Temp\Main.html from DXL then how can I open it? Thanks & Regards Irfan |
|
![]() |
|
![]() |
|
Open a Stream to read from file "c:\\temp\\main.html", example in DXL help:
Files and streams example program This example creates a temporary file, writes some data to it, saves it, renames it, reads from the new file, and then deletes it: // file (Stream) DXL example /* example file I/O program */ string filename = tempFileName // get a scratch // file print "Writing to " filename "\n" Stream out = write filename out << 'x' "" // write a char (via a string) out << 1.001 "\n" // a real (must be last // thing on line) out << 42 "\n" // an int (has to be last thing on line) out << "hello world\na second line\n" // a string close out // write a file to read back in again string oldName = filename filename = tempFileName // get a new file name renameFile(oldName, filename) // move the file we wrote earlier print "Reading from " filename "\n" Stream input = read filename char c // declare some variable real r int i input >> c input >> r input >> i print c " " r " " i "\n" // check data type read/writes string str // do rest line by line while (true) { input >> str // read a line at a // time if (end of input) break print str "\n" // str does not // include the newline } print readFile filename // read the whole lot // into a string close input deleteFile filename // delete the file ------------------------- Pekka.Makinen@softqa.fi SoftQA Oy -http://www.softqa.fi/ |
|
![]() |
|
![]() |
|
Thanks for your reply.
I think you have mis understood my question. Or maybe my statement was confusing. My question was to open a file in a window. Not to read the contents of the file in the stream. Well, I achieved it by using activateURL. But the activateURL will just work for HTML pages I guess. Any idea how to open an existing TextFile/WordFile/ExcelFile in a new window? the system command can be used. but is there any other way? Thanks & Regards Irfaan |
|
![]() |
|
![]() |
|
You can use the 'system' command to open files in Windows. I've got lots of DXL that does this:
system("Notepad.exe " NameTextFile). In your case with an HTM file, I suppose you'd need to do this: system("explorer.exe " NameHTMFile) These work so long as the executable (notepad) is in the 'path', in this case c:\Windows. Other files such as WinWord.exe will need to be located on the machine and put into the system command; that's actually rather difficult since it can be in different locations on different systems. - Louie |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Open a File present in Windows Directory
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.