|
|
Hi ALL,
I want to create new dir on specified path of remote server. How to use CreateDir() function of CFtpConnection class.
Thanks in Advance
atul
|
|
|
|
|
Atul23 wrote: How to use CreateDir() function of CFtpConnection class.
CFtpConnection::CreateDirectory just takes a path string.
What exactly are you having trouble with?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
how i can check whether the argument lpStr in FillStr function is initialized or not?
class myClass
{
public :
myClass()
{
}
~myClass()
{
}
LPSTR lpStr ;
};
int FillStr( <code>LPSTR lpStr</code> )
{
if( lpStr )
{
strcpy( lpStr , "myData" ) ;
return 1 ;
}
return 0 ;
}
void main()
{
myClass obj ;
if( FillStr( obj.lpStr ) )
{
printf( "%s" , obj.lpStr ) ;
}
}
Thanks & Regards
|
|
|
|
|
strcpy( lpStr , "myData" ) ;
This is a disaster waiting to happen based upon the way lpStr was passed in to your function. There is no indication to your method how big the buffer that lpstr points to so for all it knows, it might overwrite the buffer with the strcpy().
You never allocate memory for the buffer in your code. You should put that member pointer to the string in your initialization list for the class and set it to null or zero to ensure it has a known state before the class constructor is run.
If you know the buffer size, you can (reliably) check for the null terminator without worrying about overwriting the buffer. If the null terminator is at index zero, then it's empty. However, that does not necessarily mean that it wasn't initialized since "\0" is a valid string to initialize it with.
You might want to consider using an already existing string class written by someone who has thought all the possibilities out already.
|
|
|
|
|
hi my code is:
char* test;<br />
<br />
test = (char *)malloc(strlen("Clerk")*sizeof(char));<br />
strcpy(test,"Clerk");<br />
if(test == "Clerk")<br />
printf("ok");<br />
if(strcmp(test,"Clerk"))<br />
printf("ok2");<br />
system("pause");
how ever as you can see both if statement doesnt work f this is so? how am i supposs to compare the strings?
please help i am rather urgent thx
|
|
|
|
|
neodeaths wrote: if(strcmp(test,"Clerk"))
strcmp return 0 if both strings are equal,try
if(strcmp(test,"Clerk")==0)
Thanks & Regards
|
|
|
|
|
neodeaths wrote: test = (char *)malloc(strlen("Clerk")*sizeof(char));
strcpy(test,"Clerk");
The first line does not allocate enough space to contain the trailing \0, so that your next statement overruns the buffer. <understatement>This is not good.</understatement>
neodeaths wrote: if(test == "Clerk")
This is not the right way to compared strings that are accessed by a char * . Use strncmp or one of its cousins. The == only works on things like CString, which contain a comparison operator within their definition.
neodeaths wrote: if(strcmp(test,"Clerk"))
Read the documentation for the return type of the strcmp functions and that will tell you what is wrong with this statement.
Judy
|
|
|
|
|
Hi all,
Using code given on this link "http://www.codeproject.com/file/self_extractor.asp" i am preparing a exe file. But when i run this exe on another computer which is not having vc++ 6.0 installed in it. It gives an error of MFC42D.dll missing. What should i change its setting so that application should run properly....
Thanks in advance
|
|
|
|
|
The debug version needs not only MFC42D.dll, but also other debug versions of dlls, like MSVCRTD.DLL.
Try to build a release version instead, good luck.
|
|
|
|
|
|
neha.agarwal27 wrote: i am preparing a exe file. But when i run this exe on another computer which is not having vc++ 6.0 installed in it. It gives an error of MFC42D.dll missing. What should i change its setting so that application should run properly....
please build that executable in release mode
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Please refer here[^] for more information.
Regards,
Paresh.
|
|
|
|
|
Hi,
I have found very good information from this blog.
http://blogs.msdn.com/vcblog/archive/2007/10/12/how-to-redistribute-the-visual-c-libraries-with-your-application.aspx?CommentPosted=true#commentmessage[^]
But I have one quetion and also problem which is related to this blog topic redistributing the library.
I have created Visual Studio’s setup project in which I have added Activex (.ocx) control in it and also I have included appropriate .MSM file and its accompanying policy .MSM to distribute the library.
My package is created successfully(in VS 2005).
And I try to install it on the different machine(without VS 2005) but ask for the installing .Net Framework 2.0 but I did not install it and try to install other setup file(which also created with our main setup file) and it perfactly installed.
And now What I have to do to use that Activex (.ocx) control directly in other application.
May I directly register it using REGSVR32.exe or any other setting I have to do?
Please suggest me if you can. It will be very helpful to me.
Thanks.
Ashish Bhatt
|
|
|
|
|
Hi All,
I have solved my problem But as I explained in my problwem that I have to register my Activex control manualy using REGSVR32.exe but now I want that my activex control should be registerd directly during setup installation.I little much know how to register activex using DllRegisterServer but how can I code for that in setup project?Should I have to include other project in that setup project's solution?
Your any suggetion will be apprecited by me.Your reply is valuable for me.
Thanks in Advance.
Ashish Bhatt
|
|
|
|
|
Make sure your .ocx is added to the installation project to be installaed to some location.
In the Visual Studio Installer, in the "Project Exporer" you should have an item called "Associations". Double click on this to open the view.
I'm assuming the .ocx is an ActiveX control which would mean you want to add a COM Object. Use the ActiveX controls CLSID for the identifier. Make sure it is selected and go over the "Properties" window. Select "Component", click the "..." button and hit the "the following component" radio button, and double click on your .ocx file in the list.
The other options in the Properties window will default to the settings needed for InProc Servers (if I remember correctly) so if your component is typical, you will likely use the defaults but be aware of these settings if you find it's still not registering correctly.
One word of caution, the MSI will register and deregister the file the CLSID path refers to for you. During development, when you manually register new versions, always keep in mind to check OLEView to ensure the last registered ProgID is pointing to the CLSID component that you would expect. This is more troublesome in a VB environment since you have to explicitly set "binary compatibility" to reuse the same CLSID. Just be aware to always check OLEView if something is not right on your development box. I find I still need to use "regsvr32.exe" on a regular basis without regards to my deployment .msi during development.
Hope that helps
|
|
|
|
|
Hi all,
I made MFC dialog based application under VC 2005. I also made package for it. It runs perfectly on other windows machine. Now I want to deploy this MFC based application on Linux machine. What should i do to accomplish this task? Please help out in this. Any help is highly appreciated
Hemang
|
|
|
|
|
Hemang Raval wrote: Now I want to deploy this MFC based application on Linux machine.
AFAIK, MFC application is not supported on Linux plateform, you might be requiring third party framework to do so like QT etc or wait for other GURU's to comment
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
You will need to rewrite your application to support Linux's windowing system. MFC is Windows only. There are numerous cross-platform tools to help. If you like MFC, try wxWidgets.
Judy
|
|
|
|
|
-you may want to take a look at wine and winelib. These can be used to run your application under linux in an emulated win32 environment or to make a port recompiling and linking against winelib. Several windows applications have been "ported" to linux using winelib (google's picasa for example).
--
Miguel A. Vilariño
Software Developer
|
|
|
|
|
Hi all,
I am using ZLib for compression and decompression of files in my code. My problem is code is working fine in xp but when i decompress my files(specially exe files) in vista it gives an error stating Software has stoped working. How to solve this problem.
Thanks in advance
|
|
|
|
|
Your attempt to decompress/compress an .exe gives the error, or trying to run the .exe gives the error?
Where are you compressing/decompressing the files to?
Is the compress/decompress being run on the Vista box?
Is UAC turned on? Is File Virtualization active?
Are you an administrator or user?
Are you deleting the old .exe to verify current attempts are generating files? Sometimes, if the file write is failing and there was previous file from a previous test in the directory I'm trying to create it to, it's easy to think the old file is the newly created on from the last attempt.
Are you sure it's Vista or is it because your running it on another machine with a different initial memory at locations of your pointers. Sometimes, if you fail to initialize pointers, and the program is run in the same context on many boxes with the same ghost image, you'll get lucky and the memory that just happens to be lying at the location of a pointer is null, you get by for months until someone runs it on a different context, different box with a different OS, etc...
It's usually time well spent to check your pointer initializations when code seems to work fine on one set of boxes then acts strange on other images or boxes.
Just some thoughts.
|
|
|
|
|
neha.agarwal27 wrote: in vista it gives an error stating Software has stoped working.
I haven't heard of a problem with zlib on Vista, which error code do you get from zlib?
|
|
|
|
|
I get the data from file by using this code
<br />
void CSearchDlg::OnFileOpen() <br />
{<br />
CFileDialog fd(TRUE,NULL,NULL,NULL,"Text file|*.txt");<br />
<br />
if (fd.DoModal()==IDOK)<br />
{<br />
<br />
CStdioFile s( fd.GetPathName(),CFile::modeRead);<br />
<br />
s.ReadString(temp);<br />
dat+=temp;<br />
dat+="\n";<br />
<br />
while(!feof(s.m_pStream))<br />
{<br />
s.ReadString(temp);<br />
dat+=temp;<br />
dat+="\n";<br />
}<br />
}<br />
<br />
}<br />
And then I need to extract the data from CString object(that is dat) in each line.
How can I do?
|
|
|
|
|
No native way, I think.
Use the CString member functions to do it manually.
Or replace the method.
|
|
|
|