|
-
December 19th, 2002, 10:16 AM
#1
fopen - very important problem
Hi,
if I create two applcation in C++. The first application open a file and send at the secondo application the pointer a file. The Second application fill the file and call the first application. The first application close the file.
Is possible to open a file from an application different of the application which fille the same file?
How?
Thanks !!!!
-
December 19th, 2002, 10:57 AM
#2
It's an open/shut case
duvaft,
1) You should create and open the file with one application and perform the needed operations on the file for this one application. Then you must close the file in the first application.
2) Open the file in the second application (we will assume this file now exists and is closed). Be sure to use the append flag such that the contents of the file are not truncated or deleted. Move the file pointer to the end of the file and perform the operations on the file in the second application.
It is difficult on most modern operating systems to share file pointers between applications. If you really want to share an opened file among applications in the Win32 environment, you can take a look at "named kernel objects" and the established use of file-objects created using CreateFile(...).
Good luck.
Chris.
Last edited by dude_1967; December 19th, 2002 at 11:00 AM.
You're gonna go blind staring into that box all day.
-
December 19th, 2002, 11:36 AM
#3
There are several solutions. One solution is file-mapping. This solution requeres that you know the second application is running. In other words, the two applications must be sychronized. This is not a problem since you are developing both applications.
Anothe solution is COM. This is more elegant and can be more difficult.
Kuphryn
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|