Click here to Skip to main content
15,912,756 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Implemeting C++ code into a C project Pin
Orhun Birsoy25-Jun-07 12:52
Orhun Birsoy25-Jun-07 12:52 
GeneralRe: Implemeting C++ code into a C project Pin
ForNow25-Jun-07 23:39
ForNow25-Jun-07 23:39 
Questionneed help with port reading! Pin
Leo_133125-Jun-07 0:31
Leo_133125-Jun-07 0:31 
AnswerRe: need help with port reading! Pin
CPallini25-Jun-07 0:42
mveCPallini25-Jun-07 0:42 
AnswerRe: need help with port reading! Pin
Roger Stoltz25-Jun-07 0:49
Roger Stoltz25-Jun-07 0:49 
GeneralRe: need help with port reading! Pin
Leo_133126-Jun-07 7:31
Leo_133126-Jun-07 7:31 
GeneralRe: need help with port reading! Pin
flippydeflippydebop26-Jun-07 12:47
flippydeflippydebop26-Jun-07 12:47 
QuestionAn error occur when accessing the file Pin
Y_Kaushik25-Jun-07 0:27
Y_Kaushik25-Jun-07 0:27 
Hello Guru's

I am writing below code for copy the content of buffer to file

CString strLine = "";
CString buffer = "";
CStdioFile fileObj,filewrite;
CString fname;


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

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

/*//////////////////////Copying file to another folder//////////////////////////*/

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

///////////////////////////////////////////////////

filewrite.Open(str,CFile::modeCreate|CFile::modeWrite);

strLine.Empty();

while(filewrite.ReadString(strLine))
{
filewrite.WriteString(strLine);
fname += strLine + "\r\n";
}
filewrite.Close();
MessageBox(fname);


I am understand where i am wrong .
The above code work correctly up to

CString strLine = "";
CString buffer = "";
CStdioFile fileObj,filewrite;
CString fname;


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

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

/*//////////////////////Copying file to another folder//////////////////////////*/

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

and i can create an 0 byte .txt file using this .But when i try to copy content on buffer to file . I am become fail I think this code of line is wrong .

filewrite.Open(str,CFile::modeCreate|CFile::modeWrite);

strLine.Empty();

while(filewrite.ReadString(strLine))
{
filewrite.WriteString(strLine);
fname += strLine + "\r\n";
}
filewrite.Close();
MessageBox(fname);

if any one in the world tell me how can we solve this problem.

Regard's
Kaushik

AnswerRe: An error occur when accessing the file Pin
Hamid_RT25-Jun-07 0:53
Hamid_RT25-Jun-07 0:53 
GeneralRe: An error occur when accessing the file Pin
Y_Kaushik25-Jun-07 0:58
Y_Kaushik25-Jun-07 0:58 
GeneralRe: An error occur when accessing the file Pin
Y_Kaushik25-Jun-07 1:10
Y_Kaushik25-Jun-07 1:10 
AnswerRe: An error occur when accessing the file Pin
Rajkumar R25-Jun-07 1:16
Rajkumar R25-Jun-07 1:16 
Questioncontact to Microsoft SQL server Pin
includeh1025-Jun-07 0:26
includeh1025-Jun-07 0:26 
AnswerRe: contact to Microsoft SQL server Pin
Hamid_RT25-Jun-07 0:47
Hamid_RT25-Jun-07 0:47 
GeneralRe: contact to Microsoft SQL server Pin
includeh1025-Jun-07 2:20
includeh1025-Jun-07 2:20 
GeneralRe: contact to Microsoft SQL server Pin
Hamid_RT25-Jun-07 5:31
Hamid_RT25-Jun-07 5:31 
QuestionHow to change color of menu-bar? Pin
includeh1025-Jun-07 0:04
includeh1025-Jun-07 0:04 
QuestionInvisitasking Pin
kenhty24-Jun-07 23:53
kenhty24-Jun-07 23:53 
QuestionDebug Error!!!! Pin
James_Programmer24-Jun-07 23:53
James_Programmer24-Jun-07 23:53 
AnswerRe: Debug Error!!!! Pin
Programm3r25-Jun-07 0:22
Programm3r25-Jun-07 0:22 
QuestionPlease give me solution for this Memory leakage problem Pin
James_Programmer24-Jun-07 23:37
James_Programmer24-Jun-07 23:37 
AnswerRe: Please give me solution for this Memory leakage problem Pin
Karismatic24-Jun-07 23:59
Karismatic24-Jun-07 23:59 
AnswerRe: Please give me solution for this Memory leakage problem Pin
Rajkumar R25-Jun-07 0:03
Rajkumar R25-Jun-07 0:03 
GeneralRe: Please give me solution for this Memory leakage problem Pin
James_Programmer25-Jun-07 0:11
James_Programmer25-Jun-07 0:11 
AnswerRe: Please give me solution for this Memory leakage problem Pin
Rajkumar R25-Jun-07 0:38
Rajkumar R25-Jun-07 0:38 

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.