| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
You may try this file.clear() after u use a file.
=====maybe u should first post ur code. ![]() |
|
#3
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > Some wierd problems with files |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|