GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 01-May-2005, 16:59
bretter bretter is offline
New Member
 
Join Date: Nov 2004
Posts: 4
bretter is on a distinguished road

Help With Fstream and system()


Hello, i'm trying to make a multiplayer (console) verson of texas holdem for my school. So far i've been using text files, the problem i have run into is that i need to have upto 5 programs talking to eachother. So if i want it to be one players turn my plan was to just while loop a text file until its time for them, but what i've run into is a problem with text file sharing. The programs get hung up that they cant read/write becouse its in use. So if anyone has any suggestions i would greatly appreciate it even if its a whole new concept on multiplayer thanks alot.
  #2  
Old 01-May-2005, 17:47
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,335
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all
You need to open and close the files as fast as possible.
When you get an error on an open, wait maybe a few milliseconds and try again.
__________________

During the election they said Obama could only be elected when pigs fly. Well, we currently have an epidemic of Swine Flu. Coincidence?
  #3  
Old 01-May-2005, 17:51
bretter bretter is offline
New Member
 
Join Date: Nov 2004
Posts: 4
bretter is on a distinguished road
Quote:
Originally Posted by WaltP
You need to open and close the files as fast as possible.
When you get an error on an open, wait maybe a few milliseconds and try again.

How do i do that? and will it mostly only error on open and not close?
  #4  
Old 01-May-2005, 19:58
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,335
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all
Quote:
Originally Posted by bretter
How do i do that?

Code:
Open File Read date Close file
and
Code:
Open File Write date Close file

Quote:
Originally Posted by bretter
and will it mostly only error on open and not close?
I usually don't look for an error on close, although you can if you want. But look up the error codes returned for whatever open statement you're using and check for "already open" error code for your retry loop.
__________________

During the election they said Obama could only be elected when pigs fly. Well, we currently have an epidemic of Swine Flu. Coincidence?
 
 

Recent GIDBlogProgramming ebook direct download available by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 22:00.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.