C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 9th, 2006, 02:55 PM
DardaDai DardaDai is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2006
Posts: 11 DardaDai User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 28 m 53 sec
Reputation Power: 0
Some wierd problems with files

Hi,

til today i always worked with 1 file at a time...
but now i need to work with more then 1 file and i encountered some really wierd problems

i thought that after that i "close" file i can open new one without any problems but it seems that there are few things that i should do before i open new one or my program freaks out... any idea what is the safest way to read from file close it and open new one and do the same ?

the first thing i notice is when i try to open a non existing file the command file.fail() -> gives 0 but then my program just freez at the second that i'll try to open new one

second if i open file close it and open the same one again again it freez

and the wierdest thing is when i open an empy file - it enters a loop same loop like put a char into int.

any ideas ?!

thanks ahead

Reply With Quote
  #2  
Old March 9th, 2006, 09:11 PM
lostlander lostlander is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2006
Posts: 3 lostlander User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 40 m
Reputation Power: 0
Send a message via MSN to lostlander
You may try this file.clear() after u use a file.
=====maybe u should first post ur code.

Reply With Quote
  #3  
Old March 10th, 2006, 10:06 AM
DardaDai DardaDai is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2006
Posts: 11 DardaDai User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 28 m 53 sec
Reputation Power: 0
i used that .clear() option - without it you can't even change files (i don't know why)

the code is kinda big - even the relevant parts are long.

the wierdest thing is when i try to open the same file twice (open, close , clear and then open again)

it start to read it - and freez if i'll open it once it works perfect - even if i'll take the same file and give it diffrent name and open it, it will work

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > Some wierd problems with files


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT