CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #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

  2. #2
    Join Date
    Aug 2001
    Location
    Stockholm, Sweden
    Posts
    1,664
    - 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.

  3. #3
    hello
    if i used files then, it is very slow
    please help me with examples

  4. #4
    Join Date
    Oct 2002
    Posts
    1,134
    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

  5. #5
    Join Date
    Nov 2002
    Location
    Israel
    Posts
    182
    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
  •  





Click Here to Expand Forum to Full Width

Featured