Click here to Skip to main content
15,900,461 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questiondll for project Pin
MA Awan20-Oct-09 18:54
MA Awan20-Oct-09 18:54 
AnswerRe: dll for project Pin
Cedric Moonen20-Oct-09 20:17
Cedric Moonen20-Oct-09 20:17 
GeneralRe: dll for project Pin
Richard MacCutchan21-Oct-09 0:20
mveRichard MacCutchan21-Oct-09 0:20 
AnswerRe: dll for project Pin
CPallini20-Oct-09 20:29
mveCPallini20-Oct-09 20:29 
AnswerRe: dll for project Pin
Rajesh R Subramanian20-Oct-09 20:32
professionalRajesh R Subramanian20-Oct-09 20:32 
QuestionException: This may be due to a corruption of the heap, which indicates a bug in WBEventsSheetCalculate.exe or any of the DLLs it has loaded. Pin
NarVish20-Oct-09 18:40
NarVish20-Oct-09 18:40 
QuestionRe: Exception: This may be due to a corruption of the heap, which indicates a bug in WBEventsSheetCalculate.exe or any of the DLLs it has loaded. Pin
Roger Stoltz21-Oct-09 2:53
Roger Stoltz21-Oct-09 2:53 
QuestionNeed help for CStdioFile/CFile [modified] Pin
Nicholas Amh20-Oct-09 17:35
Nicholas Amh20-Oct-09 17:35 
Hi all, I ahve 2 questions.
First:
I would like to know how to convert the text from file into the format below.

In my program,
UINT Test_a(LPVOID lParam)
{
CStdioFile f1(_T("C:/abc/t1.txt"), CFile::modeWrite|CFile::OpenFlags::modeCreate|CFile::shareExclusive);
CString f1_txt;
......
f1_txt.Format("%le %le %le\n", x, y, z);
f1.Write(f1_txt, f1_txt.GetLength());
.....
f1.Close();
}

UINT Test_b(LPVOID lParam)
{
CStdioFile f2;
f2.Open((_T("C:/abc/t1.txt"), CFile::modeRead | CFile::shareExclusive);
CString rdtxt;
//how to read the text from the file t1 and convert it to "%le %le %le\n", &x, &y, &z format?
Can i do something like this?
while(f2.ReadString(rdtxt) != NULL)
{
rdtxt.Format("%le %le %le\n", &x, &y, &z);
....
}
f2.Close();
}


Second:
For CFile.Read. When i put CFile::shareExclusive in my f1.Open, i will have error. The error is
Debug Assertion Failed!
Program: c:\Documents and settings\...\GUi.exe
File:f:\dd\vctools\crt_bld\self_x86\crt\src\fscanf.c
Line:52
Expression:(stream != NULL)


When i change shareExclusive to shareDenyNone or shareDenyWrite, then the program work. How can i solve this? I don't other to open the file when i am running/using the file in my C++ program. The file is quite big, about 8M.

My program code:
text.txt file is created above my program using CStdioFile f2(_T("C:/abc/test.txt), CFile::modeWrite|CFile:shareExclusive);

CStdioFile f1;
CString rd;
CString output;
f1.Open(_T(C:/abc/test.txt"), CFile::modeRead | CFile::shareExclusive);
while(f1.ReadString(rd)!= NULL)
{
output += rd;
output.Format("%lf %lf %lf\n", &a, &b, &c);
.......
.......
}
f1.Close();

Thanks for helping out.

modified on Wednesday, October 21, 2009 1:03 AM

AnswerRe: Need help for CStdioFile/CFile Pin
Naveen20-Oct-09 17:55
Naveen20-Oct-09 17:55 
GeneralRe: Need help for CStdioFile/CFile Pin
Nicholas Amh20-Oct-09 19:10
Nicholas Amh20-Oct-09 19:10 
QuestionRe: Need help for CStdioFile/CFile Pin
Randor 20-Oct-09 19:23
professional Randor 20-Oct-09 19:23 
AnswerRe: Need help for CStdioFile/CFile Pin
Nicholas Amh20-Oct-09 19:44
Nicholas Amh20-Oct-09 19:44 
GeneralRe: Need help for CStdioFile/CFile Pin
Randor 20-Oct-09 21:08
professional Randor 20-Oct-09 21:08 
AnswerRe: Need help for CStdioFile/CFile Pin
Adam Roderick J20-Oct-09 20:23
Adam Roderick J20-Oct-09 20:23 
GeneralRe: Need help for CStdioFile/CFile Pin
Nicholas Amh20-Oct-09 20:59
Nicholas Amh20-Oct-09 20:59 
GeneralRe: Need help for CStdioFile/CFile Pin
Richard MacCutchan21-Oct-09 2:33
mveRichard MacCutchan21-Oct-09 2:33 
QuestionWhen is a CWnd ready to receive messages Pin
ForNow20-Oct-09 16:14
ForNow20-Oct-09 16:14 
AnswerRe: When is a CWnd ready to receive messages Pin
Naveen20-Oct-09 18:12
Naveen20-Oct-09 18:12 
GeneralRe: When is a CWnd ready to receive messages Pin
ForNow20-Oct-09 18:19
ForNow20-Oct-09 18:19 
GeneralRe: When is a CWnd ready to receive messages Pin
Naveen20-Oct-09 18:29
Naveen20-Oct-09 18:29 
GeneralRe: When is a CWnd ready to receive messages Pin
ForNow20-Oct-09 18:39
ForNow20-Oct-09 18:39 
GeneralRe: When is a CWnd ready to receive messages Pin
Naveen20-Oct-09 18:43
Naveen20-Oct-09 18:43 
GeneralRe: When is a CWnd ready to receive messages Pin
ForNow20-Oct-09 18:54
ForNow20-Oct-09 18:54 
GeneralRe: When is a CWnd ready to receive messages Pin
Hans Dietrich20-Oct-09 21:59
mentorHans Dietrich20-Oct-09 21:59 
GeneralRe: When is a CWnd ready to receive messages Pin
ForNow21-Oct-09 14:42
ForNow21-Oct-09 14: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.