Alright, this is the situation i think is happening in my program.
I believe that there is an object FileStream //write, conflicting with an object FileStream //read. Either that or the conflict must be the two objects I use (for output/input) for FileStream object. In either case, I should be able to solve this simply with destructors.But for debugging knowledge this is what im requesting. How do I find out if two or more objects are in memory at the same time. For example,

FileStream *object1;  //for reading setting.dat file,in one part of the program

FileStream *object2;  //for writing setting.dat file,in another part of the program

If(//object1 && object2 are both in memory at the time this function is evoked) MessageBox::Show(S"Two filestream objects:{0},{1} are located in memory", object1Name, object2Name); 
MessageBox::Show(S"These objects are potentially conflicting one another");

Edited by pyTony: fixed formating

11 Years
Discussion Span
Last Post by f1 fan

what development environment are you using?

I am using c++ .net with GUI with visual studio 2003 .net


if dont know c++ you can write it in C#

so you are having a problem reading/writing because a different filestream is reading/writing it?

are you properly closing the filestreams after you are finished useing them?

a common place it doesnt get closed is if u are using a try statment and the close it outside of it

or test wiether the other filestream is open or closed, i think there is a bool for that


if you are using VS, why not just stick in a debug point at the spot where the filestreams are being created and step through it


My money is on you havent called filestream.close() after reading or writing. This means the file is exclusively locked and can not be used by anything else (the same effect as if you try to open a word doc on a shared folder when someone else has it opened... you cannot write until they finish)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.