|
A good starting point [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
MethodToChaos wrote: it certainly is not a trivial task
yes this is not trival task. just try to export your project in VS.NET and compile it and solve the compilation problem one by one.. thats the only way you convert your project to new enviornment.
Please see, VS2005 are more type compliant and non relaxing. so prepare for some hardwork
"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/codeProject$$>
|
|
|
|
|
the codeproject has some articles maybe they will be helpful for you.
|
|
|
|
|
Hi to all!
My app is using threads sometimes, and in each one I do some work with MySql database (version is 4.0.21). When I exit my app I get numerous resource leak like "Resource like : allocated by InitializeCriticalSection in C:\....\¸mysys\my_thr_init.c".
Any help and how to avoid this?
I read somewhere to use thread specific api's like 'mysql_thread_init()' or 'mysql_thread_end()'. The thing is I open connection at start which i use all the time, and then close it when I exit the program.
P.S.
I don't use thread all the times I also do some work with database at program's runtime.
Thanks!
|
|
|
|
|
Hi,
Is there any way to find out the call stack, as I want to check if a particular function is being called in a call stack?
Thanks,
Mushq
|
|
|
|
|
If you are using VC 6 then use Alt + 7 or from Menu View, Debug Windows, Call Stack.
OR
If you are using version higher than VC 6 (like VC7,VC8) then use Alt + 7 or Alt + Ctrl + C or from menu Debug, Windows, Call Stack.
Mukesh Kumar
Software Engineer
|
|
|
|
|
Hi Mukesh, Thanks for the reply.
ctually I want to access it by code i.e. programmatically accessing the call stack. Sorry for the confusion.
Regards,
Mushq
|
|
|
|
|
What do you mean ? Do you want to access it by code ? Or just look at it yourself ? If it is the latter, it depends of which IDE you are using. For VS2005, you go into 'Debug' -> 'Windows' -> 'Call Stack'. You have of course to start debugging. The call stack will be displayed whenver you hit a breakpoint.
|
|
|
|
|
Thanks for reply.
Cedric Moonen wrote: What do you mean ? Do you want to access it by code ? Or just look at it yourself ?
Actually I want to access it by code i.e. programmatically accessing the call stack. Sorry for the confusion.
Regards,
Mushq
|
|
|
|
|
|
I need to add " to a string both at the beging and ending of the string and make the string looking like
"test string"
" should also part of the string... pls advice
|
|
|
|
|
You need to add an escape character ('\' before the character). It will look like this: \"test string\".
|
|
|
|
|
char ch ='\"';
lgAssistantLocStr = ch + LocStr + ch;
I am getting expected string but it is not working as excepted.... is that due to some interal problems...pls advice
|
|
|
|
|
ptr_Electron wrote: but it is not working as excepted
Which means what ??
ptr_Electron wrote: char ch ='\"';
lgAssistantLocStr = ch + LocStr + ch;
You can't concatenate char pointers like that. What is the type of lgAssistantLocStr and of LocStr ?
|
|
|
|
|
it is string...
string lgAssistantLocStr;
|
|
|
|
|
And what about the first question I asked ?
Anyway, you can't add a std::string to a character because a character doesn't have an overloaded operator +.
Do something like that:
std::string strTemp = "\"";<br />
lgAssistantLocStr = strTemp + YourString + strTemp;
|
|
|
|
|
ptr_Electron wrote: I am getting expected string but it is not working as excepted....
What do you mean?
How is lgAssistantLocStr defined?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
it is a string
string lgAssistantLocStr;
|
|
|
|
|
OK, but what is the expected behaviour and what is the problem you're complaing about?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
ptr_Electron wrote: I am getting expected string but it is not working as excepted...
This makes no sense.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
When i execute the code given below in C on Visual Studio 2008 i get the following error messages
1>------ Build started: Project: socketclientc, Configuration: Debug Win32 ------
1>Compiling...
1>client.c
1> c:\program files\microsoft sdks\windows\v6.0a\include\winsock.h(872) : see declaration of 'WSACleanup'
1>c:\documents and settings\hp\my documents\visual studio 2008\projects\socketclientc\socketclientc\client.c(69) : error C2059: syntax error : 'return'
1>c:\documents and settings\hp\my documents\visual studio 2008\projects\socketclientc\socketclientc\client.c(70) : error C2059: syntax error : '}'
1>Build log was saved at "file://c:\Documents and Settings\HP\My Documents\Visual Studio 2008\Projects\socketclientc\socketclientc\Debug\BuildLog.htm"
1>socketclientc - 25 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
// practiceclient.c : Defines the entry point for the console application.
#include <stdio.h>
#include <winsock2.h>
int main()
{
WSADATA wsadata;
WORD wVersion;
int wsaerr;
wVersion = MAKEWORD(2,2);
wsaerr = WSAStartup(wVersion, &wsadata);
if(wsaerr != 0)
{
printf("There is a DLL linker problem");
return 0 ;
}
else
printf("\nDLL working and compatible!!");
SOCKET mysocket;
mysocket = socket(AF_INET,SOCK_STREAM,0);
if(mysocket == SOCKET_ERROR)
{
printf("socket cannote be created error: %d",WSAGetLastError);
WSACleanup();
return 0;
}
printf("\nSocket created successfully");
sockaddr_in Cservice;
Cservice.sin_family = AF_INET;
Cservice.sin_addr.s_addr = inet_addr("127.0.0.1");
Cservice.sin_port = htons(55555);
if(connect(mysocket,(sockaddr *)&Cservice,sizeof(Cservice))== SOCKET_ERROR)
{
printf("Connect is unsuccessful, error:%d",WSAGetLastError);
WSACleanup();
getchar();
return 0;
}
int bytesent;
int byterecv=SOCKET_ERROR;
char sendbuff[200] = "Client:This is a test string from client.";
char recvbuff[200] = "";
while(byterecv == SOCKET_ERROR)
{
byterecv = recv(mysocket,recvbuff,strlen(recvbuff),0);
if(byterecv==0||byterecv==WSAECONNRESET)
printf("\nClient: Connection closed");
if(byterecv>0)
return 0;
else
{
printf("\nClient: recv() is OK");
printf("\nClient: The string received %s",recvbuff);
printf("\nClient: The bytes received %d",byterecv);
}
}
bytesent=send(mysocket,sendbuff,strlen(sendbuff),0);
if(bytesent == SOCKET_ERROR)
printf("\nClient: send() failed:%d",WSAGetLastError);
else
{
printf("\n Client: send() is OK");
printf("\n Client: The string sent %s",sendbuff);
printf("\n Client: The number of bytes sent %d",bytesent);
}
getchar();
WSACleanup();
return 0;
}
|
|
|
|
|
Please check the posting guidelines before posting a message. Put your code inside code or pre tags and replace the < and > characters so that they can be visible. Furthermore, you selected only a part of the errors and you took the less relevant ones
Did you include winsock2.h ?
|
|
|
|
|
yea i used winsock2.h
and this program executes without problem in C++ but when i save the file as .c extension adn then i get so many errors do you want me to post my code again.
i need serrious help here
|
|
|
|
|
I would like to see which files you include and the complete errors that you have.
|
|
|
|
|
Thank you for reminding me to do that. Thanks a million i got it working all over again.
|
|
|
|