Click here to Skip to main content
15,887,746 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: _declspec and uuid Pin
Matthew Faithfull19-Jun-07 4:33
Matthew Faithfull19-Jun-07 4:33 
GeneralRe: _declspec and uuid Pin
Stephen Caldwell19-Jun-07 5:11
Stephen Caldwell19-Jun-07 5:11 
GeneralRe: _declspec and uuid Pin
Roger Stoltz19-Jun-07 5:12
Roger Stoltz19-Jun-07 5:12 
QuestionProblem with creating richeditctrl? Pin
Banks K19-Jun-07 3:05
Banks K19-Jun-07 3:05 
AnswerRe: Problem with creating richeditctrl? Pin
Rolando Cruz19-Jun-07 3:29
Rolando Cruz19-Jun-07 3:29 
GeneralRe: Problem with creating richeditctrl? Pin
Banks K19-Jun-07 3:36
Banks K19-Jun-07 3:36 
GeneralRe: Problem with creating richeditctrl? Pin
Rolando Cruz19-Jun-07 3:51
Rolando Cruz19-Jun-07 3:51 
QuestionFile reading problem Pin
Y_Kaushik19-Jun-07 3:05
Y_Kaushik19-Jun-07 3:05 
Hello Guru

I am making an application for reading .txt file from Hard Hisk and
copy this file to folder and save it name in database.

In this program i can read data from hard drive and copy the file to
folderConfused | :confused: and also save its name in database.

Whenever i create a file in folder .(Its create successfully but
when try to reading contant of old file and writing new one an
assertion occor.

my code for that function is below.

CString str;
int ids;
CFileDialog Obj(TRUE);
if(Obj.DoModal() ==IDC_BUTTON3)
{
m_Upload = Obj.GetFileName();
}
str.Empty();
str = Obj.GetPathName();
SetDlgItemText(IDC_EDIT1,str);
///////////////////////////////////////////////////////////////////
/* reading file data from disk */
/////////////////////////////////////////////////////////////////
CString strLine = "";
CString buffer = "";
CStdioFile fileObj,filewrite;
CString fname;


fileObj.Open(str, CFile::modeRead | CFile::shareDenyWrite);

fname = fileObj.GetFileName();
// MessageBox(fname);


while(fileObj.ReadString(strLine))
{
fileObj.ReadString(strLine);
// fileObj.WriteString(fname);
buffer += strLine + "\r\n";
}
fileObj.Close();
// MessageBox(buffer);
SetDlgItemText(IDC_EDIT3,buffer);

fileObj.Open("c:\\UserFolder\\" + fname + ".txt",CFile::modeCreate,NULL);

Its run up to here successfully.

Its create a blank file in folder .


Now i am writing above code like this ( simple reading data from old file and writing it to new one an assertion occor . The code is below.


CString str;
int ids;
CFileDialog Obj(TRUE);
if(Obj.DoModal() ==IDC_BUTTON3)
{
m_Upload = Obj.GetFileName();
}
str.Empty();
str = Obj.GetPathName();
SetDlgItemText(IDC_EDIT1,str);
///////////////////////////////////////////////////////////////////
/* reading file data from disk */
/////////////////////////////////////////////////////////////////
CString strLine = "";
CString buffer = "";
CStdioFile fileObj,filewrite;
CString fname;


fileObj.Open(str, CFile::modeRead | CFile::shareDenyWrite);

fname = fileObj.GetFileName();
// MessageBox(fname);


while(fileObj.ReadString(strLine))
{
fileObj.ReadString(strLine);
// fileObj.WriteString(fname);
buffer += strLine + "\r\n";
}
fileObj.Close();
// MessageBox(buffer);
SetDlgItemText(IDC_EDIT3,buffer);

/*//////////////////////Copying file to another folder//////////////////////////*/
str.Empty();
fileObj.Open(str,CFile::modeRead);

while(filewrite.ReadString(strLine))
{

filewrite.WriteString(fname);
buffer += strLine + "\r\n";
}

fileObj.Open("c:\\UserFolder\\" + fname + ".txt",CFile::modeCreate,NULL);

How can i write content of old one to new one.

Any one Please told me .











Regard's
Kaushik

AnswerRe: File reading problem Pin
Rolando Cruz19-Jun-07 3:38
Rolando Cruz19-Jun-07 3:38 
AnswerRe: File reading problem Pin
Iain Clarke, Warrior Programmer19-Jun-07 4:08
Iain Clarke, Warrior Programmer19-Jun-07 4:08 
QuestionCOM/DCOM is now what? Pin
Rolando Cruz19-Jun-07 2:11
Rolando Cruz19-Jun-07 2:11 
AnswerRe: COM/DCOM is now what? Pin
bob1697219-Jun-07 4:34
bob1697219-Jun-07 4:34 
GeneralRe: COM/DCOM is now what? Pin
Rolando Cruz19-Jun-07 5:08
Rolando Cruz19-Jun-07 5:08 
AnswerRe: COM/DCOM is now what? Pin
James R. Twine19-Jun-07 4:51
James R. Twine19-Jun-07 4:51 
AnswerRe: COM/DCOM is now what? Pin
Rolando Cruz19-Jun-07 5:14
Rolando Cruz19-Jun-07 5:14 
GeneralRe: COM/DCOM is now what? Pin
Matthew Faithfull19-Jun-07 7:51
Matthew Faithfull19-Jun-07 7:51 
GeneralRe: COM/DCOM is now what? Pin
Rolando Cruz19-Jun-07 7:56
Rolando Cruz19-Jun-07 7:56 
QuestionUnable to launch dialog box Pin
Wamuti19-Jun-07 2:09
Wamuti19-Jun-07 2:09 
AnswerRe: Unable to launch dialog box Pin
Roger Stoltz19-Jun-07 2:40
Roger Stoltz19-Jun-07 2:40 
GeneralRe: Unable to launch dialog box Pin
Wamuti19-Jun-07 3:09
Wamuti19-Jun-07 3:09 
GeneralRe: Unable to launch dialog box Pin
Wamuti19-Jun-07 3:17
Wamuti19-Jun-07 3:17 
QuestionHow to: Structure initialization Pin
Programm3r19-Jun-07 0:01
Programm3r19-Jun-07 0:01 
AnswerRe: How to: Structure initialization Pin
Rage19-Jun-07 0:27
professionalRage19-Jun-07 0:27 
GeneralRe: How to: Structure initialization Pin
Programm3r19-Jun-07 0:47
Programm3r19-Jun-07 0:47 
QuestionDifference between DLL & Process ??? Pin
amitmistry_petlad 18-Jun-07 23:45
amitmistry_petlad 18-Jun-07 23:45 

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.