Click here to Skip to main content
15,888,257 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow do i check whether a window is opened or not Win 32 Pin
arun_pk28-May-10 2:21
arun_pk28-May-10 2:21 
AnswerRe: How do i check whether a window is opened or not Win 32 Pin
Aescleal28-May-10 2:30
Aescleal28-May-10 2:30 
AnswerRe: How do i check whether a window is opened or not Win 32 Pin
Emilio Garavaglia28-May-10 2:50
Emilio Garavaglia28-May-10 2:50 
QuestionProblem with manifest file Pin
sashoalm28-May-10 1:55
sashoalm28-May-10 1:55 
AnswerRe: Problem with manifest file Pin
sashoalm28-May-10 3:31
sashoalm28-May-10 3:31 
GeneralRe: Problem with manifest file Pin
Randor 28-May-10 4:04
professional Randor 28-May-10 4:04 
QuestionHow to find a file is already opened or not? Pin
Paulraj G27-May-10 23:37
Paulraj G27-May-10 23:37 
AnswerRe: How to find a file is already opened or not? Pin
Aescleal28-May-10 0:07
Aescleal28-May-10 0:07 
It all depends on how you opened the file. There's no reason why you can't have two streams based on the same file. e.g. on my system:

int main()
{
	std::ifstream str1( "c:\\test.txt" );
	std::ifstream str2( "c:\\test.txt" );

	int n = 0;
	int m = 0;

	if( ( str1 >> n ) && ( str2 >> m ) )
	{
		std::cout << "Woo hoo! Opened both!" << std::endl;
	}
}


Always comes up with the "Woo hoo!" message and both n and m are set to the integer that's in the first token of the file.

Unfortunately there's no way of opening a file using the standard library that locks it against further reading so if you're using streams you're not going to be able to tell easily if someone else has got it open.

Cheers,

Ash
AnswerRe: How to find a file is already opened or not? Pin
Richard MacCutchan28-May-10 3:01
mveRichard MacCutchan28-May-10 3:01 
AnswerRe: How to find a file is already opened or not? Pin
Randor 28-May-10 4:07
professional Randor 28-May-10 4:07 
GeneralRe: How to find a file is already opened or not? Pin
Aescleal28-May-10 4:21
Aescleal28-May-10 4:21 
AnswerRe: How to find a file is already opened or not? Pin
ThatsAlok30-May-10 20:53
ThatsAlok30-May-10 20:53 
AnswerRe: How to find a file is already opened or not? Pin
rp_suman31-May-10 19:06
rp_suman31-May-10 19:06 
QuestionNot catching the exception Pin
gsainath4u27-May-10 22:27
gsainath4u27-May-10 22:27 
AnswerRe: Not catching the exception Pin
Code-o-mat27-May-10 22:31
Code-o-mat27-May-10 22:31 
GeneralRe: Not catching the exception PinPopular
sashoalm27-May-10 22:34
sashoalm27-May-10 22:34 
GeneralRe: Not catching the exception Pin
Code-o-mat27-May-10 22:41
Code-o-mat27-May-10 22:41 
GeneralRe: Not catching the exception Pin
gsainath4u27-May-10 22:51
gsainath4u27-May-10 22:51 
GeneralRe: Not catching the exception Pin
sashoalm27-May-10 23:21
sashoalm27-May-10 23:21 
GeneralRe: Not catching the exception Pin
Code-o-mat27-May-10 23:34
Code-o-mat27-May-10 23:34 
GeneralRe: Not catching the exception Pin
gsainath4u27-May-10 22:47
gsainath4u27-May-10 22:47 
GeneralRe: Not catching the exception Pin
Code-o-mat27-May-10 22:51
Code-o-mat27-May-10 22:51 
GeneralRe: Not catching the exception Pin
Aescleal27-May-10 23:04
Aescleal27-May-10 23:04 
GeneralRe: Not catching the exception Pin
gsainath4u28-May-10 0:01
gsainath4u28-May-10 0:01 
GeneralRe: Not catching the exception Pin
gsainath4u27-May-10 23:58
gsainath4u27-May-10 23:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.