concurentiel access to a file

This is a discussion on concurentiel access to a file within the C++ Programming forums, part of the General Programming Boards category; I have two process to do the same thing, how to organize the access to the file where each process ...

  1. #1
    Registered User
    Join Date
    Jul 2005
    Posts
    8

    concurentiel access to a file

    I have two process to do the same thing, how to organize the access to the file where each process 'll write.

    there is C++ code :

    FILE * pFile;
    pFile = fopen ("wirelessRecv.tr","a+"); ( the same file for the two process)

    macmib_.ReceivedFragmentCount++; (each process have a counter )

    fprintf (pFile, "\n "TIME_FORMAT" %d %d %d" ,
    Scheduler::instance().clock(), netif_->node()->nodeid(),
    macmib_.ReceivedFragmentCount, ch->size()-phymib_.getHdrLen11());

    fclose (pFile);

    Thanks
    Zayzay

  2. #2
    Banned
    Join Date
    Jun 2005
    Posts
    594
    FILE and fprintf is C code, not c++

  3. #3
    ... arjunajay's Avatar
    Join Date
    May 2005
    Posts
    203
    c++ file i/o is better and less confusing...

  4. #4
    Banned
    Join Date
    Jun 2005
    Posts
    594
    agreed, so here is a link sense he seems lost


    i suppose thsi will do, quick off google

  5. #5
    Registered User
    Join Date
    Jul 2005
    Posts
    8
    Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-22-2008, 12:19 AM
  2. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 01:36 PM
  3. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 05:54 PM
  4. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21