|
check whether the file already contains data or the value of strAbc at
strLine.Format("%s %d %d %d",strAbc,dDlgResID,dwData,nCmd);
|
|
|
|
|
well, yes.. it will, because I am always opeing ...appending the new string.. closing
|
|
|
|
|
I mean may be the file already contains the junk data, otherwise strAbc contains junk data. Check whether strAbc contains correct data when you debugged at Format() statement.
|
|
|
|
|
If you are 'dumping' the entire contents of a CString instance to a file, then be aware that the class encapsulates more than just a data buffer with some text in it. It has other data items such as length for example.
|
|
|
|
|
strLine.Format("%s %d %d %d",strAbc,dDlgResID,dwData,nCmd);
strLine=strLine+"\r\n";
CStdioFile file;
file.Open("c:\\kkk.txt", CStdioFile::modeCreate|CStdioFile::modeNoTruncate|CStdioFile::modeReadWrite);
file.SeekToEnd();
file.Write(strLine,strLine.GetLength());
Thanks Friends....above code Did the clean job
|
|
|
|
|
Excellent! Don't listen to those GetBuffer() fanatics
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
<br />
#include "FindNoPlat.h"<br />
#include "stdafx.h"<br />
#include "ODBC1.h"<br />
<br />
#include "ODBC1Set.h"<br />
#include "ODBC1Doc.h"<br />
#include "ODBC1View.h"<br />
<br />
#ifdef _DEBUG<br />
#define new DEBUG_NEW<br />
#undef THIS_FILE<br />
static char THIS_FILE[] = __FILE__;<br />
#endif<br />
<br />
<br />
IMPLEMENT_DYNCREATE(CODBC1View, CRecordView)<br />
<br />
BEGIN_MESSAGE_MAP(CODBC1View, CRecordView)<br />
ON_COMMAND(ID_RECORD_APPEND, OnRecordAppend)<br />
ON_BN_CLICKED(IDC_CHOICE1, OnChoice1)<br />
ON_BN_CLICKED(IDC_CHOICE2, OnChoice2)<br />
ON_COMMAND(ID_RECORD_FIND, OnRecordFind)<br />
ON_COMMAND(ID_FILE_PRINT, CRecordView::OnFilePrint)<br />
ON_COMMAND(ID_FILE_PRINT_DIRECT, CRecordView::OnFilePrint)<br />
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CRecordView::OnFilePrintPreview)<br />
END_MESSAGE_MAP()<br />
<br />
<br />
CODBC1View::CODBC1View()<br />
: CRecordView(CODBC1View::IDD)<br />
{<br />
m_pSet = NULL;<br />
m_cStatus_saman = _T("");<br />
<br />
}<br />
<br />
CODBC1View::~CODBC1View()<br />
{<br />
}<br />
<br />
void CODBC1View::DoDataExchange(CDataExchange* pDX)<br />
{<br />
int iStrLength;<br />
<br />
iStrLength = m_pSet->m_Status_saman.GetLength();<br />
m_cStatus_saman="$"+m_pSet->m_Status_saman.Left(iStrLength-2);<br />
<br />
<br />
CRecordView::DoDataExchange(pDX);<br />
DDX_Control(pDX, IDC_CHOICE2, m_oChoice2);<br />
DDX_Control(pDX, IDC_CHOICE1, m_oChoice1);<br />
DDX_Control(pDX, IDC_EDIT4, m_opermit_perjalanan);<br />
DDX_Control(pDX, IDC_EDIT3, m_oStatus_saman);<br />
DDX_Control(pDX, IDC_EDIT2, m_oSykt);<br />
DDX_Control(pDX, IDC_EDIT1, m_oNo_plat);<br />
DDX_FieldText(pDX, IDC_EDIT1, m_pSet->m_No_plat, m_pSet);<br />
DDX_FieldText(pDX, IDC_EDIT2, m_pSet->m_Sykt, m_pSet);<br />
DDX_FieldText(pDX, IDC_EDIT4, m_pSet->m_permit_perjalanan, m_pSet);<br />
DDX_Text(pDX, IDC_EDIT3, m_cStatus_saman);<br />
}<br />
<br />
BOOL CODBC1View::PreCreateWindow(CREATESTRUCT& cs)<br />
{<br />
<br />
return CRecordView::PreCreateWindow(cs);<br />
}<br />
<br />
void CODBC1View::OnInitialUpdate()<br />
{<br />
m_pSet = &GetDocument()->m_oDBC1Set;<br />
CRecordView::OnInitialUpdate();<br />
GetParentFrame()->RecalcLayout();<br />
ResizeParentToFit();<br />
<br />
}<br />
<br />
<br />
BOOL CODBC1View::OnPreparePrinting(CPrintInfo* pInfo)<br />
{<br />
return DoPreparePrinting(pInfo);<br />
}<br />
<br />
void CODBC1View::OnBeginPrinting(CDC* , CPrintInfo* )<br />
{<br />
}<br />
<br />
void CODBC1View::OnEndPrinting(CDC* , CPrintInfo* )<br />
{<br />
}<br />
<br />
<br />
#ifdef _DEBUG<br />
void CODBC1View::AssertValid() const<br />
{<br />
CRecordView::AssertValid();<br />
}<br />
<br />
void CODBC1View::Dump(CDumpContext& dc) const<br />
{<br />
CRecordView::Dump(dc);<br />
}<br />
<br />
CODBC1Doc* CODBC1View::GetDocument()
{<br />
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CODBC1Doc)));<br />
return (CODBC1Doc*)m_pDocument;<br />
}<br />
#endif //_DEBUG<br />
<br />
CRecordset* CODBC1View::OnGetRecordset()<br />
{<br />
return m_pSet;<br />
}<br />
<br />
<br />
<br />
void CODBC1View::OnRecordAppend() <br />
{<br />
<br />
if (m_pSet->CanAppend() == 0)<br />
MessageBox("Cannot Append Records",<br />
"Database Opening Error",<br />
MB_OK|MB_ICONERROR);<br />
<br />
else<br />
{<br />
m_oChoice1.SetWindowText("Submit Data");<br />
m_oChoice2.SetWindowText("Cancel");<br />
<br />
<br />
<br />
m_oNo_plat.SetWindowText("");<br />
m_oSykt.SetWindowText("");<br />
m_oStatus_saman.SetWindowText("");<br />
m_opermit_perjalanan.SetWindowText("");<br />
}<br />
<br />
}<br />
<br />
void CODBC1View::OnChoice1() <br />
{<br />
<br />
<br />
}<br />
<br />
void CODBC1View::OnChoice2() <br />
{<br />
<br />
}<br />
<br />
void CODBC1View::OnRecordFind() <br />
{<br />
<br />
FindNoPlat oFindIt;
BOOL Found=FALSE;
int iStrLength;
char* cQuantity="Empty1";
char* cStorage="Empty2";
CDBVariant varBookmark;
<br />
if (oFindIt.DoModal()==IDOK)<br />
<br />
{<br />
if (m_pSet->CanBookmark())<br />
m_pSet->GetBookmark(varBookmark);<br />
<br />
m_pSet->MoveFirst();<br />
<br />
<br />
while (!m_pSet->IsEOF() ^ Found);<br />
<br />
{<br />
if (m_pSet->m_No_plat == oFindIt.m_FindNoPlat);<br />
Found=TRUE;<br />
<br />
<br />
m_pSet->MoveNext();<br />
<br />
}<br />
<br />
if (!Found);<br />
<br />
{<br />
<br />
MessageBox("Record not found!",<br />
"Database Error",<br />
MB_OK|MB_ICONERROR);<br />
<br />
if (m_pSet->CanBookmark())<br />
m_pSet->SetBookmark(varBookmark);<br />
<br />
else<br />
m_pSet->MoveFirst();<br />
<br />
}<br />
<br />
<br />
{<br />
<br />
m_oNo_plat.SetWindowText(m_pSet->m_No_plat);<br />
m_oSykt.SetWindowText(m_pSet->m_Sykt);<br />
m_opermit_perjalanan.SetWindowText(m_pSet->m_permit_perjalanan);<br />
<br />
<br />
iStrLength = m_pSet->m_Status_saman.GetLength();<br />
m_oStatus_saman.SetWindowText("$" + m_pSet->m_Status_saman);<br />
}<br />
}<br />
<br />
<br />
}<br />
<br />
<br />
hello,
this code is use to find the data in database(ms access).. im building a database application using ODBC..
there were 5 error while compile it:
error C2065: 'FindNoPlat' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'oFindIt'
error C2065: 'oFindIt' : undeclared identifier
error C2228: left of '.DoModal' must have class/struct/union type
error C2228: left of '.m_FindNoPlat' must have class/struct/union type
can someone explain it to me...
tq,
|
|
|
|
|
ieyra204 wrote: error C2065: 'FindNoPlat' : undeclared identifier
C2065
ieyra204 wrote: error C2146: syntax error : missing ';' before identifier 'oFindIt'
C2146
etc.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Error messages are quite informative, for instance,
ieyra204 wrote: error C2065: 'FindNoPlat' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'oFindIt'
suggest checking if there is a class named FindNoPlat in FindNoPlat.h header file.
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 application is having Memory Leakage!! How to Solve this problem..
|
|
|
|
|
I would use a stop cork and block the leakage. Seriously, you need to be more specific than that.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Rajesh R Subramanian wrote: I would use a stop cork and block the leakage
Memory Leakage!!
what do you say about "Memory Boosters".
|
|
|
|
|
Rajkumar R wrote: what do you say about "Memory Boosters".
I can't remember.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I am poor in english, but i didn't asked "what did you said about "Memory boosters""
DavidCrow wrote: I can't remember.
may be using a stop cork prevents further leakage.
|
|
|
|
|
Perform cleanup correctly (i.e. you really need to be more specific).
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
|
|
|
|
|
I've found the best way is to make sure I destroy any resources
that I've acquired when they are no longer needed.
Trust me on this one....it works.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: I've found the best way is to make sure I destroy any resources
that I've acquired when they are no longer needed.
Hello Mr. Mark,
I've destroyed my PS3 after I finished playing burnout on it, since I no longer needed it today. I then burnt my refrigerator after I took out all the beer. I'm 'working up' on the air conditioner with a hammer now. But the memory leakage still exists. Please help me with further course of action.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
|
When I read part of your post in the response email, I thought it was from the OP.
I was thinking, oh no, this guy's falling apart hehe.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Hi to All
i have one doubt regarding with my project.
1. I created one DLL file in this DLL file was compiled Visual Studio 2003 and windows XP.
2. Then i want to create that DLL file in Windows Vista but in vista is not compatible for visual studio 2003 (i referred in msdn ) and i do installed service pack of 2003 in XP .Then generating one same DLL.
3. And then i was run that external application in windows vista but that dll could not compiling ..how to solve this problem?
*****THANKS N ADVANCE****
Mathen.K
(I WILL TRY MY LEVEL BEST )
|
|
|
|
|
rowdy_vc++ wrote: ...dll could not compiling ..how to solve this problem?
What problem?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
yes i know ....in this compiled DLL used in one external application ..its successfully in windowsXP but in Windows vista..its not compiled ..thats why i am saying..
i need ...how to access visual studio 2003 create one dll..in this dll access in vista how?
*****THANKS N ADVANCE****
Mathen.K
(I WILL TRY MY LEVEL BEST )
|
|
|
|
|
Can't you make one single meaningful post?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
rowdy_vc++ wrote: its not compiled ..thats why i am saying..
And I'm saying, what's the (compiler) problem?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|