Click here to Skip to main content
15,923,789 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: global buffer or passing by reference? Pin
billiam90424-Sep-05 13:05
billiam90424-Sep-05 13:05 
GeneralRe: global buffer or passing by reference? Pin
Achim Klein25-Sep-05 5:31
Achim Klein25-Sep-05 5:31 
AnswerRe: global buffer or passing by reference? Pin
Achim Klein24-Sep-05 1:32
Achim Klein24-Sep-05 1:32 
GeneralRe: global buffer or passing by reference? Pin
billiam90424-Sep-05 12:28
billiam90424-Sep-05 12:28 
AnswerRe: global buffer or passing by reference? Pin
Achim Klein25-Sep-05 5:48
Achim Klein25-Sep-05 5:48 
GeneralRe: global buffer or passing by reference? Pin
billiam90425-Sep-05 5:57
billiam90425-Sep-05 5:57 
GeneralRe: global buffer or passing by reference? Pin
Achim Klein25-Sep-05 6:02
Achim Klein25-Sep-05 6:02 
GeneralRe: global buffer or passing by reference? Pin
Achim Klein25-Sep-05 6:50
Achim Klein25-Sep-05 6:50 
I guess you have a class named CWavRead.
I guess you want to pass the buffer that this class fills to other functions.
I guess all of this takes place somewhere inside your CSingleDlg class.
Please correct me, if I'm wrong.

In this case my header file would approximately look like this:
// forward declaration
class CWavRead;

// class definition
class CSingleDlg
{
public:

   ...

private:

   // my dialog 'knows' an object of the CWavRead class
   CWavRead* m_wavReader;
};

And my implementation file would approximately look like this:
#include "SingleDlg.h"
#include "WavRead.h"

// constructor
CSingleDlg::CSingleDlg()
{
   m_wavReader = new CWavRead;
}

// destructor
CSingleDlg::~CSingleDlg()
{
   delete m_wavReader;
}

// read wav file
CSingleDlg::OnFileOpen()
{
   m_wavReader->read(path);
}

// modify wav data
CSingleDlg::OnEditModify()
{
   // get data
   long size = m_wavReader->getBufferSize();
   BYTE* buffer = m_wavReader->getBuffer();

   // create local (temporary) object
   CWavOperator operator;
 
  // pass the read data
  operator.DoSomething(buffer, size);
}


Is it useful ?


We can do no great things, only small things with great love. - Mother Theresa
GeneralRe: global buffer or passing by reference? Pin
Achim Klein25-Sep-05 6:52
Achim Klein25-Sep-05 6:52 
GeneralRe: global buffer or passing by reference? Pin
billiam90425-Sep-05 7:08
billiam90425-Sep-05 7:08 
GeneralRe: global buffer or passing by reference? Pin
Achim Klein25-Sep-05 7:17
Achim Klein25-Sep-05 7:17 
GeneralRe: global buffer or passing by reference? Pin
billiam90425-Sep-05 7:27
billiam90425-Sep-05 7:27 
GeneralRe: global buffer or passing by reference? Pin
Achim Klein25-Sep-05 7:36
Achim Klein25-Sep-05 7:36 
GeneralRe: global buffer or passing by reference? Pin
billiam90425-Sep-05 7:46
billiam90425-Sep-05 7:46 
GeneralRe: global buffer or passing by reference? Pin
Achim Klein25-Sep-05 8:05
Achim Klein25-Sep-05 8:05 
GeneralRe: global buffer or passing by reference? Pin
billiam90425-Sep-05 8:39
billiam90425-Sep-05 8:39 
GeneralRe: global buffer or passing by reference? Pin
Achim Klein25-Sep-05 9:37
Achim Klein25-Sep-05 9:37 
GeneralRe: global buffer or passing by reference? Pin
billiam90425-Sep-05 10:07
billiam90425-Sep-05 10:07 
Questionrecord Voice Pin
bulgaa23-Sep-05 15:55
bulgaa23-Sep-05 15:55 
AnswerRe: record Voice Pin
billiam90423-Sep-05 16:38
billiam90423-Sep-05 16:38 
AnswerRe: record Voice Pin
meiyueh23-Sep-05 20:50
meiyueh23-Sep-05 20:50 
QuestionI Need to change a single CListCtrl item color Pin
assay23-Sep-05 11:52
assay23-Sep-05 11:52 
AnswerRe: I Need to change a single CListCtrl item color Pin
Shog923-Sep-05 12:32
sitebuilderShog923-Sep-05 12:32 
GeneralRe: I Need to change a single CListCtrl item color Pin
vikas amin24-Sep-05 3:08
vikas amin24-Sep-05 3:08 
AnswerRe: I Need to change a single CListCtrl item color Pin
vikas amin24-Sep-05 4:42
vikas amin24-Sep-05 4:42 

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.