-
November 20th, 2002, 02:38 AM
#1
To avoid frequent disk access
i am using dialog based application
1) it should a get data every 10sec and strore it in a file1..
2) it should get data every 1 hour and store it in a file2
3) some modules uses this file1 & file2 frequently for drawing ,printing and for some calculation.
can u suggest how to avoid i/o access frequently-
to prevent the disk accessing.
Moreover when the file should not contain more than 2000 record it should be <=2000 records
please give me some suggestion
-
November 20th, 2002, 03:26 AM
#2
- You can use shared memory (memory mapped file), but then you need to add synchronization (gloabl mutex objects).
- Implement a COM (or RPC) server and some interfaces. The program that produces data should probably be the server.
- Use sockets.
Your current file approach is of course the most simple solution.
-
November 20th, 2002, 05:23 AM
#3
hello
if i used files then, it is very slow
please help me with examples
-
November 20th, 2002, 07:47 AM
#4
It sounds like the "very slow" part is because of your reading from the files for drawing, printing, etc. If you only have 2000 records, then why not use CMemFile to keep a copy of your disk data?
Regards
Robert Thompson
-
November 20th, 2002, 07:57 AM
#5
If the speed of your application depends on the disk access only, you should load your files into memory - just detect the file size, allocate memory and read data from the file into the memory. But, I'm afraid, now you will write all your code again from the beginning. Excuse me if you don't need my help in this but here is the functions you will use: CreateFile, ReadFile, realloc. Of course you can use MFC instead of WinAPI.
Good luck
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
|