|
YES, I tested it maney times.
|
|
|
|
|
Did you remember to call FindNextFile() before using any of the other CFtpFileFind methods? What does the following produce:
BOOL bWorking = finder.FindFile("*.*");
while (bWorking)
{
bWorking = finder.FindNextFile();
TRACE("]%s[\n", (LPCTSTR) finder.GetFileURL());
} Does it show the name of the file with spaces in its name?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
If I get FileURL, Every thing is OK, But I can not manipulate the file
with space filename.
|
|
|
|
|
Define "manipulate." Has the original problem been fixed, and now you have encountered another?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
My_Fun()
{
...
pFtpConn = mysession.GetFtpConnection( my_ftpserver, my_user, my_pass );
CFtpFileFind finder(pFtpConn);
BOOL bWorking = finder.FindFile("/*.*" );
while( bWorking )
{
bWorking = finder.FindNextFile();
sURL = finder.GetFileURL();
pFtpConn->GetFile( sURL, "C:\Dloadfile.inf" );
}
...
}
Nothing donwload!!!
|
|
|
|
|
lewislewis_lewis wrote:
pFtpConn->GetFile( sURL, "C:\Dloadfile.inf" );
You need to use two backslashes.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
My_Fun()
{
...
pFtpConn = mysession.GetFtpConnection( my_ftpserver, my_user, my_pass );
CFtpFileFind finder(pFtpConn);
BOOL bWorking = finder.FindFile("/*.*" );
while( bWorking )
{
bWorking = finder.FindNextFile();
sURL = finder.GetFileURL();
pFtpConn->GetFile( sURL, "C:/Dloadfile.inf" );
}
...
}
No work. I think GetFileURL return URL only, can not use as file name.
For file name, only work for normal file name. Why?
How to manipulate a file with filename have space?
|
|
|
|
|
lewislewis_lewis wrote:
sURL = finder.GetFileURL();
pFtpConn->GetFile( sURL, "C:/Dloadfile.inf" );
Is sURL non-empty? What does GetFile() return?
Have you tried to retrieve the file using command line FTP (to isolate if the problem is in your code or in the FTP process)?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
the sURL = "ftp://ftp.ftpserver.com/Dloadfile.inf"
|
|
|
|
|
lewislewis_lewis wrote:
the sURL = "ftp://ftp.ftpserver.com/Dloadfile.inf"
There are no spaces in the name.
Have you tried the command-line FTP?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
the sURL = "ftp://ftp.ftpserver.com/My Projectinfo.inf"
When I use MS explorer, in adreess box, I type in: ftp://ftp.ftpserver.com, I can see all files, and use copy-paste will download any files!
|
|
|
|
|
Ok, what does GetFile() return? If it's FALSE , what about GetLastError() .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Error code is 12003, but string is empty
|
|
|
|
|
lewislewis_lewis wrote:
Error code is 12003...
Which is ERROR_INTERNET_EXTENDED_ERROR . Use InternetGetLastResponseInfo() to get more details.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Do we have the way to manipulate the files?
|
|
|
|
|
I'm not sure what you mean by "manipulate." You are wanting to download a file from an FTP server using GetFile() . My suggestions thus far have been unsuccessful (it's not like I was holding something back, I just don't have an FTP server to test stuff on). You might try using the CFtpConnection ::OpenFile() /CInternetFile::Read() /CInternetFile::Write() trio instead.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
ftp://ftp.microsoft.com/PSS/Tools/Developer%20Support Tools/WINDBG 4.0.18/
dbg_x86.exe
and use CFtpConnection class function : GetFile, OpenFile, SetCurrentDirectory
Thanks
|
|
|
|
|
This worked for me:
CInternetSession ISession;
CFtpConnection *pFTPConnect = NULL;
BOOL bContinue;
pFTPConnect = ISession.GetFtpConnection(_T("ftp.microsoft.com"), _T("anonymous"), _T("name@company.com"));
bContinue = pFTPConnect->SetCurrentDirectory(_T("/PSS"));
if (bContinue)
bContinue = pFTPConnect->SetCurrentDirectory(_T("Tools"));
if (bContinue)
bContinue = pFTPConnect->SetCurrentDirectory(_T("Developer Support Tools"));
if (bContinue)
bContinue = pFTPConnect->SetCurrentDirectory(_T("WINDBG 4.0.18"));
if (bContinue)
pFTPConnect->GetFile(_T("dbg_x86.exe"), _T("c:\\dbg_x86.exe"));
if (NULL != pFTPConnect)
pFTPConnect->Close();
delete pFTPConnect; You'll need to put in the necessary error checking.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
1)If your code ok for "ftp://ftp.microsoft.com/deskapps/games/public/cc3/Screenshots/Stalingrad zoom out.bmp"?
The file name have space!!!
2)_T() is necessary? why?
3) How to use CFtpConnection ::OpenFile()/CInternetFile::Read()/CInternetFile::Write()? Why not use CFtpConnection::GetFile()
Thanks!!!
|
|
|
|
|
I tried to disable the "Save" toolbutton on the toolbar.
I tried to set the state of "Save" toolbutton to disabled mode by specifying
TBSTATE_INDETERMINATE . But this doesnt disable the save toolbutton.
TBBUTTONINFO buttonInfo;
buttonInfo.cbSize = sizeof( TBBUTTONINFO );
buttonInfo.dwMask = TBIF_COMMAND;
buttonInfo.fsState = TBSTATE_INDETERMINATE ;
m_wndToolBar.GetToolBarCtrl().SetButtonInfo(ID2_FILE_SAVE, &buttonInfo);
Let me know the exact procedure to do the same.
Thanx in advance
laiju
|
|
|
|
|
Check out ON_UPDATE_COMMAND_UI(ID2_FILE_SAVE, ...) . In the handler function, you can easily enable/disable the Save button.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
|
Hi,
I have a query on pointer arithmetic.
I declared a structure like this
struct myStruct{
int index;
char sz[124];
};
Inside the main(), I created 10000 objects of the structure and assigned it to a pointer variable.
myStruct* obj = new myStruct[10001];
memset( obj,0,sizeof(myStruct) * 10005);
myStruct* obj1 = obj;
long l1 = 0;
for( long l=0;l<100000000;l++)
{
obj++;
l1 += obj->index; //just an addition so that compiler wont remove the previous line
if( i % 10000 == 0 ){
obj = obj1;
l1 = 0; //reseting the values;
}
}
When I executed this, it took me 8 sec.
But if I reduce the size of myStruct to 64, it takes only 4 sec.
ie.
struct myStruct{
int index;
char sz[60];
};
and again reducing the size to 32, it takes only 2 secs.
I examined the assembly code which was generated by Disassembly, and the only change was in the 2nd line
obj++;
mov edx,dword ptr [ebp-14h]
add edx,100h
mov dword ptr [ebp-14h],edx
thats in
add edx,100h ( 256 b ) time : 8sec
add edx,20h ( 32 b ) time : 2sec
Can anybody pl. give me an explanation for this behaviour.
I was able to reproduce this behaviour in Unix also....
Thanks and Regards
Jagadeesh
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
This is an effect of L1 cache. You did not mention the CPU you were using. I assume it was a P4. The L1 access line size is 64 bytes if my memory serves me right. If there are no alignment issues(your compiler often does a good job at this), the smaller size the structure is the more effective for a single L1 line access. Nowadays, people often talk about structure of arrary (SoA), that address such issues....
|
|
|
|
|
Hello,
Jagadeesh VN wrote:
Inside the main(), I created 10000 objects of the structure and assigned it to a pointer variable.
myStruct* obj = new myStruct[10001];<br />
memset( obj,0,sizeof(myStruct) * 10005);
Here you actually create 10.001 structs and initialize 10.005! This is very wrong!
Jagadeesh VN wrote:
for( long l=0;l<100000000;l++)<br />
{<br />
obj++;<br />
l1 += obj->index;
<br />
if( i % 10000 == 0 ){<br />
obj = obj1;<br />
l1 = 0;
}
A couple of questions on this piece of code:
<list> Why the dummy addition (l1 += obj->index; ) The compiler won't remove the line, since you use the object further down your code!
Why such a long loop?
Your loop does nothing usefull, why?
To get to an answer, I honestly don't think that the long loop is your problem. I think the problem lies with memset() . Let me explain: your execution time drops liniear with the size of the struct. So the size of the array decreases also liniear. (You halve the size of the stuct, so the size of the array is also halved.) So the amount of memory that memset() has to fill is also halved!
Besides that, your loop executes 100 million times! Don't expect that to finish in a few ms..
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|