Click here to Skip to main content
15,903,203 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Screen Capturing in JPG format and not Bitmap Pin
Dhiraj kumar Saini2-Dec-08 1:37
Dhiraj kumar Saini2-Dec-08 1:37 
AnswerRe: Screen Capturing in JPG format and not Bitmap Pin
A_xin2-Dec-08 4:26
A_xin2-Dec-08 4:26 
QuestionProblem in building DLL Pin
maheshbhoir.home2-Dec-08 0:39
maheshbhoir.home2-Dec-08 0:39 
AnswerRe: Problem in building DLL Pin
Code-o-mat2-Dec-08 0:56
Code-o-mat2-Dec-08 0:56 
GeneralRe: Problem in building DLL Pin
maheshbhoir.home2-Dec-08 1:08
maheshbhoir.home2-Dec-08 1:08 
GeneralRe: Problem in building DLL Pin
Code-o-mat2-Dec-08 1:19
Code-o-mat2-Dec-08 1:19 
QuestionC++ Accessing varibale Across Files Pin
sachin_chakote1-Dec-08 23:54
sachin_chakote1-Dec-08 23:54 
AnswerRe: C++ Accessing varibale Across Files Pin
CPallini2-Dec-08 0:09
mveCPallini2-Dec-08 0:09 
sachin_chakote wrote:
I want to use varibale across multiple files. If the varibale is updated in one file its value should be visible from other file

Your requirements define a global variable.

sachin_chakote wrote:
i tried static variable

With no luck, I suppose...

sachin_chakote wrote:
extern could not solve my problem ..

Actually extern will solve your problem, for instance, declare it extern in a common included header, say commonheader.h:
// This is commonheader.h

// Global variable declaration
extern int g_iMyCounter; 
//...


Then define it inside only one source file, for instance
// This is main.cpp

// Global variable definition
int g_iMyCounter;
//...


Finally include commonheader.h in whathever source file needs such variable, for instance

// this is auxiliary.cpp
#include "commonheader.h"

int incrementMyCounter()
{
  return ++g_iMyCounter;
}
//...


Smile | :)

If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.

This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke

[My articles]

AnswerRe: C++ Accessing varibale Across Files Pin
Jijo.Raj2-Dec-08 1:02
Jijo.Raj2-Dec-08 1:02 
QuestionConversion from long to CString? Pin
Le@rner1-Dec-08 23:46
Le@rner1-Dec-08 23:46 
AnswerRe: Conversion from long to CString? Pin
VCProgrammer2-Dec-08 0:00
VCProgrammer2-Dec-08 0:00 
AnswerRe: Conversion from long to CString? Pin
Jijo.Raj2-Dec-08 0:43
Jijo.Raj2-Dec-08 0:43 
AnswerRe: Conversion from long to CString? Pin
J. Landsheer2-Dec-08 3:42
J. Landsheer2-Dec-08 3:42 
GeneralRe: Conversion from long to CString? Pin
Le@rner2-Dec-08 17:19
Le@rner2-Dec-08 17:19 
Questionhow to read mozila firefox cookies Pin
YaronNir1-Dec-08 23:06
YaronNir1-Dec-08 23:06 
QuestionGetting Property Sheet Handle Pin
koumodaki1-Dec-08 22:27
koumodaki1-Dec-08 22:27 
QuestionRe: Getting Property Sheet Handle Pin
David Crow2-Dec-08 3:43
David Crow2-Dec-08 3:43 
AnswerRe: Getting Property Sheet Handle Pin
koumodaki2-Dec-08 19:00
koumodaki2-Dec-08 19:00 
QuestionCTreeCtrl Tree Reading Pin
Royaltvk1-Dec-08 22:22
Royaltvk1-Dec-08 22:22 
AnswerRe: CTreeCtrl Tree Reading Pin
Hamid_RT1-Dec-08 23:27
Hamid_RT1-Dec-08 23:27 
QuestionGetting hard disk name using wmi Pin
VCProgrammer1-Dec-08 21:24
VCProgrammer1-Dec-08 21:24 
AnswerRe: Getting hard disk name using wmi Pin
john56321-Dec-08 21:37
john56321-Dec-08 21:37 
GeneralRe: Getting hard disk name using wmi Pin
VCProgrammer1-Dec-08 22:16
VCProgrammer1-Dec-08 22:16 
AnswerRe: Getting hard disk name using wmi Pin
SandipG 1-Dec-08 22:37
SandipG 1-Dec-08 22:37 
QuestionRe: Getting hard disk name using wmi Pin
David Crow2-Dec-08 3:52
David Crow2-Dec-08 3:52 

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.