|
This is because usualy in an SDI application the View class constructor is called by the framework and not directly by your code.
If, for any reason you need to call the view constructor directly (not that I can see any) - you can change it to public.
|
|
|
|
|
Hi all,
I'm trying to get the directory structure of a remote computer using FTP.
It works but, if the directory name contains a space, for example: My Directory, it only takes the "My" part.
This is what I have done:
fceGetList(0,FCE_FULL_LIST,(LPSTR)DataBuffer,MAX_BUF);
Lines = fceGetString(0, FCE_GET_LINE_COUNT, (LPSTR)DataBuffer, MAX_BUF);
int i=0;
while (i<Lines)
{
Code = fceExtract((LPSTR)DataBuffer, n, 9, (LPSTR)LineBuf, 100);
Total += Code;
if(Code>0)
{
_splitpath(LineBuf,drive, dir, fname, ext);
if (strcmp(ext, "")==0)
printf("** Directory: %s\n",LineBuf);
i++;
n++;
ZeroMemory(LineBuf, 100);
}
}
Can someone please help me??
Many Thanks.
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
It seems like the problem is not with _splitpath funtions, but with my fceExtract function.
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
|
Hi all.
I have "*.dbf" file and I am trying to read it like "*.txt" file.
If you can help, tell me how can I read "*.dbf" file, or
whot is format "*.dbf" file.
|
|
|
|
|
You can use ADO to read DBF files.
The connection string should be something like this:
"Driver={Microsoft Visual FoxPro Driver}; SourceType=DBF; SourceDB=Path_to_DBF_Folder"
-- modified at 4:28 Thursday 26th April, 2007
|
|
|
|
|
Thanks, but I need to read it like file.
|
|
|
|
|
Hi All,
I need to add column header to my tree ( using CTreeCtrl ).
How can i add it in simple way ? i don't want to define some new class that inheritor from CTreeCtrl class. . .
Thanks for any help.
|
|
|
|
|
A standard tree control doesn't have columns (or column headers) - only list controls.
You might want to try using one of the many CTreeCtrl or CListCtrl derived classes located here in CodeProject that implement this exact stuff ...
-- modified at 4:04 Thursday 26th April, 2007
|
|
|
|
|
Hello together,
#include "stdafx.h"
void letsgo(int *var);
void pair(int *var);
void unpair(int *var);
int _tmain(int argc,_TCHAR *argv[])
{
int var=0;
while(var < 1000)
letsgo(&var);
printf("READY --> %d",var);
return 0;
}
void letsgo(int *var)
{
if((*var % 2) > 0)
unpair(var);
else
pair(var);
}
void pair(int *var)
{
(*var)++;
}
void unpair(int *var)
{
(*var)++;
}
Is it possible to set a breakpoint globaly on the hole "project" that a breakpoint stops if
var is equal 501 ?
But not by setting a breakpoint into function "pair" or "unpair".
It's an example to see how to set a globaly breakpoint.
The real project has a huge number of functions and loops.
There is a problem and a struct-variable gets a specific value, so i need to know
at which time the variable gets the specific value.
Big thanks !
|
|
|
|
|
If you're using VC2005 you can add a condition to a breakpoint. Here's how:
1. Add a breakpoint anywhere you want.
2. Open the "Breakpoints" window from "Debug-->Windows-->Breakpoints".
3. In the "Breakpoints" window, right-click the selected breakpoint and select "Condition...".
4. In the edit box write "var == 501" nad make sure that the "Is true" radio button is selected.
5. Run your app in debug mode.
Hope this helps ...
Guy.
|
|
|
|
|
Ok, but then i know that the variable had changed at this breakpoint.
But not where exactly the variable changed,
in my example i don't know if it's incremented at "pair" or "unpair"
But thanks for your help
|
|
|
|
|
In VS2003 you could set a breakpoint to occur when a variable changed or based on a condition
without breaking at a certain location in the code.
It doesn't look like you can do that in 2005
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Thanks Mark Salsbery
Okay, i use VS2003 (german version, so the titles of the items are propably mis-translated ).
I add a new Breakpoint, choose the tab "variable" then i add the name of the variable.
But i don't know what to add into the context.
Does the variable needs to be global?
Thanks
|
|
|
|
|
Hi,
Sorry it took so long to reply. Did you get it to work yet?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi Mark,
no, i don't get it to work
I don't add a breakpoint into the left margin, but over the menu "Add new breakpoint"
Then i add into the tab "variable" the name of my variable to test.
The condition to i==5001 and the context to {,test.cpp,}
The debugging should stop at one of the (*i)++; exactly where the variable has beeing changed
into 5001
Thanks in advance
|
|
|
|
|
OK here's the problem. You need to add the breakpoint at runtime (I just tested with your code)
Put a break point at int var=0; (first line of _tmain())
Run it
When it breaks, right click on "var" and choose "New Breakpoint"
Go to the "Data" tab
Click the "Condition" button
In the condition edit box type "var==501"
Click ok
Now you should get a warning that this type of breakpoint will make the app run SLOW.
Choose ok then hit F5 to keep running.
It will break when var == 501.
This doesn't have to be done at runtime as described but it makes it easier because VS enters the
defaults for you, the most important being the correct context in the breakpoint properties
data tab.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Big big thanks!
Now, my colleague don't need to loop x-times via F10 into a complex structure of functions to find the error.
But it takes at the 100th loop 2seconds for one incrementation, thats very very slow LOL
|
|
|
|
|
baerten wrote: But it takes at the 100th loop 2seconds for one incrementation, thats very very slow LOL
Yes! When I tested it, I resumed after the breakpoint was hit (I set it to break at 2), looping
to 1000. after a few seconds I killed the process. It should have been done in way under a
second
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi
We know that with prolog/epilog code bp is stored and we restore bp for every function call. Like this:
; Create a stack frame<br />
push ebp<br />
mov ebp,esp<br />
<br />
;codes here<br />
; Clean up the stack frame<br />
mov esp,ebp<br />
pop ebp
I read an interesting article. http://www.cprogramming.com/faq/cgi-bin/smartfaq.cgi?answer=1074726763&id=1073086407 It says:
Every time you call a function, a thingy (very technical term) called an activation record is pushed onto the stack. The activation record, also known as a stack frame, contains things such as local variables for the function, arguments, and the address of the previous activation record so that it knows how to return from whence it came. Because of these activation records, two calls to the same function aren't actually the same activation record, that's why recursion works. Each new call to fact_recursive has its own memory, its own argument copies, its own everything.
Because this all works like a stack, each new activation record covers up the previous record. When the function finally reaches the base case and returns, each activation record is popped from the stack until execution finally leaves the first call to fact_recursive. This is called unwinding the stack, you'll hear that term again sometime in your programming careers, but I won't say where.
We push bp so we can store it.
So If we optimize compiler that do not add prolog/epilog code, can't we use recursive functions? I said.
I tried with VC++ compiler by "Omittin frame pointer" /Oy . But recursive func. works. But i thought it mustnt work. I don't understand why it works. Where am i wrong?
Can you please explain reason of prolog/epilog code and whether there is a relation with prolog/epilog code with recursive func. call mechanism.
I am looking for your answers.
Thanks
|
|
|
|
|
If FPO is enabled (via the /Oy option) it doesn't effect recursive functions. The return address is still stored on the stack; if it wasn't you couldn't even return from a function.
Steve
|
|
|
|
|
Hi all,
I have generating a project like server-client communication using winsock. I would like to do that server application has keep connection to the database and retrieve some record set using CRecordset object from the database.
My questions are........
1) Can i write that CRecordset object into the file? after that can i read it from that file as a
CRecordset object? and send it to the client application.
2) If client application could retrieve the records from its retrieved CRecordset object?
If you know please tell me your suggestions and if you have any tutorials regarding to above the problem please lets me know
Thanks in Advance
regards
surezu
|
|
|
|
|
what you're after is called serialization.
as you're using MFC, CRecordset already inherits from CObject, which provides a base for serialized object.
read more on the msdn about CObject::Serialize()
|
|
|
|
|
now i'm know some more concepts in the serialization after reading MSDN document but i got some error in my following code snippet..........
<br />
1 void COBjSerializationDlg:: OnBnClickedDbw()<br />
2 {<br />
3 CString sIp,sDb,sPwd,sConn,sPort,sUn;<br />
4 sIp="192.168.2.17";<br />
5 sPort="5432";<br />
6 sPwd="fasp";<br />
7 try<br />
8 {<br />
9 sConn = "DRIVER={PostgreSQL ANSI};SERVER=" + sIp + ";port=" + sPort +<br />
";DATABASE=" + sPwd + ";UID=" + sPwd + ";PWD=" + sPwd + ";";<br />
10 db.OpenEx(sConn);<br />
11 }<br />
12 catch(CDBException *e)<br />
13 {<br />
14 MessageBox("Database Connection Refused."+e->m_strError,"DataBase<br />
15 Connection Error",MB_OK|MB_ICONERROR);<br />
16 e->Delete();<br />
17 }<br />
<br />
18 CRecordset rs(&db);<br />
<br />
19 rs.Open(AFX_DB_USE_DEFAULT_TYPE, "select name from master;");<br />
20 CFile file1;<br />
21 file1.Open("hexa.bin",CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);<br />
22 CArchive ar1(&file1,CArchive:: store);<br />
23 if(ar1.IsStoring())<br />
24 {<br />
25 CObject:: Serialize(ar1);<br />
26 ar1 << &rs;<br />
27 }<br />
28 ar1.Flush();<br />
29 ar1.Close();<br />
30 file1.Close();<br />
31 rs.Close();<br />
32 db.Close();<br />
33 }<br />
<br />
<br />
<br />
34 void COBjSerializationDlg:: OnBnClickedDbr()<br />
35 {<br />
36 CRecordset *set = new CRecordset();<br />
37 CFile file2;<br />
38 file2.Open("hexa.bin", CFile::modeRead| CFile::typeBinary);<br />
39 CArchive ar2(&file2,CArchive:: load);<br />
40 if(ar2.IsLoading())<br />
41 {<br />
42 CObject:: Serialize(ar2);<br />
43 ar2 >> set;<br />
44 }<br />
45 set.MoveFirst();<br />
46 int j;<br />
47 j = 0;<br />
48 CString s;<br />
49 while(set.IsEOF())<br />
50 {<br />
51 s = "";<br />
52 set.GetFieldValue (j,s);<br />
53 AfxMessageBox(s);<br />
54 set.MoveNext();<br />
55 }<br />
56 ar2.Flush();<br />
57 ar2.Close();<br />
58 set.Close();<br />
59 file2.Close();<br />
60 delete set;<br />
61 }
error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'CRecordset *__w64 ' (or there is no acceptable conversion)
will be thrown during the compilation of the above code at LINE.NO:43
please help me.....what i did wrong in my snippet....
|
|
|
|
|
Regarding question 1 - You might want to try deriving from CRecordset, implementing a Serialize() function and saving your objects in a CArchive ...
|
|
|
|