|
kiran.pinjarla wrote: app->appPath+"\\"+AfxGetAppName()+".exe"
GetCurrentDirectory will return "C:\folder\blah\etc" not "C:\\folder\\blah\\etc" so your slashes may get mangled
|
|
|
|
|
I haven't seen this issue discussed and I'm hoping its a simple answer. I am writing a new feature for a system that is deployed around the world (mostly Europe and Japan) that will send emails via SMTP based on certain events occurring. I have had no issues in writing the code and getting things to work correctly here in the US. But then something occurred to me...
If I deploy this thing oversees, can I expect to talk to an SMTP in a foreign country the same way I do here in the US (i.e. English commands)?
For instance, will HELO, EHLO (and the repsonses to the EHLO from the server), and the message commands like MAIL TO:, RCPT TO:, DATA:, From:, To:, Subject:, Reply-to:, and Date: be recognized as they are hard-coded English words or do I need to translate to the local languages?
Hoping that the server internals are all English but not sure. It would be OK if the error strings were internationalized, just worried about the actual commands to the server.
|
|
|
|
|
I believe that the RFC that defines the SMTP protocol does not allow for localized changes to the commands used by the protocol, so you should not have to worry about having to translate "HELO" to "HOLA" etc. I think the same goes for headers as well.
I am fairly certain about the first one, not as certain about the second.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
I think its implied as well but not explicitly stated as it is an interface definition. I think the only room for localization would be in the message strings returned preceeding the return codes. I just get a little jumpy when doing international programming.
|
|
|
|
|
I would not worry too much about the textual portion of the return codes, only the 3-digit portion to indicate warnings, success, failure, informational messages, etc. and only log the textual portion (and/or show it to a user) when a problem occurs.
IME, today's SMTP servers are quite bad at providing detailed error messages when certain problems occur (spam-check failures usually return not much error information at all other than the 3-digit code), so again, I would not worry all that much about it. Remember that the protocols, while human-readable, are designed for automated use, so paying attention to just the 3-digit error code often works more than well enough.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
I have a project with two rc files. Each rc file contain a cursor. When I try to link project, I receive error:CVTRES : fatal error CVT1100: duplicate resource. type:CURSOR, name:1, language:0x0
Build log:
Microsoft (R) Windows Resource To Object Converter Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.
adding resource. type:CURSOR, name:1, language:0x0402, flags:0x1010, size:308
adding resource. type:GROUP_CURSOR, name:101, language:0x0402, flags:0x1030, size:20
adding resource. type:CURSOR, name:1, language:0x0402, flags:0x1010, size:308
CVTRES : fatal error CVT1100: duplicate resource. type:CURSOR, name:1, language:0x0402
LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
Please help me to solve this problem.
|
|
|
|
|
You "only" got to understand the message. The cursor with the ID 1 is inserted in each file. You got to remove one.
Maybe you do this via including other header files in the *.rc files. Try to comment doubles out.
Greetings from Germany
|
|
|
|
|
I have two .rc files.
The contents of the files are:
resource1.rc:
1 CURSOR "file1.cur"
resource2.rc:
2 CURSOR "file2.cur"
No other contents in files.
And that two .rc file are in my project.
|
|
|
|
|
Look for #include "afxres.rc" string (usualy in TEXTINCLUDE 3 section)
It must be included in one file only
|
|
|
|
|
Hi,
is there an easy way (a function) to test if a CString contains only numbers?
Thanks
|
|
|
|
|
See
isdigit();
How to read your string?
|
|
|
|
|
WhiteSky wrote: atoi(m_Str);//return value is 0
If the string is as 12a3 then Index would be 12 and not 0 inspite of the fact that there exists a character in the third place.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
CString m_Str;
m_Str="123ABC";
Index=atoi(m_Str);//return value is 123
Gives 123 too, and m_Str doesn't contain only numbers...
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
speedy4711 wrote: CString contains only numbers?
CString str="1142654";
int i=atoi (str);
CString str1;str1.Format("%d",i);
if(str.GetLength ()==str1.GetLength ())
AfxMessageBox("string is pure number");
else
AfxMessageBox ("Characters exist");
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
_AnShUmAn_ wrote:
if(str.GetLength ()==str1.GetLength ())
Doesn't work with eg.
CString str="0x1142654";
|
|
|
|
|
SilentSilent wrote: Doesn't work with eg.
Since this value you are entering is a string x is treated as a character only, it doesn't represent a hexadecimal number nor did I check for this.So I would try and provide a solution for this...
Thanks for pointing this out...
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Here's a small function I use for validating user input:
bool IsNumeric(const CString& str)
{
if(str.IsEmpty())
return false;
for(int i = 0; i < str.GetLength(); i++)
if(str[i] < '0' || str[i] > '9')
return false;
return true;
} It only takes decimal non-negative integers into account. It's easy to extend for other types of numbers, should you want to.
--
Mit viel Oktan und frei von Blei, eine Kraftstoff wie Benziiiiiiin!
|
|
|
|
|
Jörgen Sigvardsson wrote: for(int i = 0; i < str.GetLength(); i++) if(str[i] < '0' || str[i] > '9') return false;
Doesn't work with eg.
CString str="0x1142654";
|
|
|
|
|
How often do you accept hexadecimal user input? And how hard would it be to extend it? I never claimed it would recognize all possible numeric syntaxes...
--
Mit viel Oktan und frei von Blei, eine Kraftstoff wie Benziiiiiiin!
|
|
|
|
|
speedy4711 wrote: test if a CString contains only numbers?
here's one more solution. You can give this a try...
CString s="253453";
CComVariant v;
v=s;
if(v.ChangeType(VT_INT)==S_OK)
{
CString str;str.Format ("%d",v.intVal );
AfxMessageBox (str);
}
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I looked over the responses, and I want to point to two possible problems.
The first may be a leading Zero ( "0123" )
and the other is a value with a comma or a sign ( "-1,5" or "+ 2.7" )
I would resolve this with checking every char of being a digit or allowed other char.
Greetings from Germany
|
|
|
|
|
Why don't you just use strtol() ?
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Here is a base-10 checker that allows for ,'s and -'s (but doesn't check for placement). You can easily extend it to check for proper placement of special characters (,'s, and -'s) as well as other base numbers and floating point numbers.
bool is_digit_base10(const CString& str)
{
static CString allowedChars = _T("0123456789,-");
const unsigned int length = str.GetLength();
for (unsigned int i = 0; i < length; ++i)
{
char buffer[2] = {0};
buffer[0] = str[i];
if (-1 == allowedChars.FindOneOf(buffer))
{
return false;
}
}
return true;
}
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
hi, i am coding a multithreading application in vc++.net 2003.
and the thread i am starting from main thread,it actually gives it's control in the hands of external code, which is acually a driver. when the work is done i want that thread to unwind, but it doesn't stops,and when i call that function again it starts a new thread.
i tried to look for a function using which i can end a thread given it's thread id.
like _endthread,_endthreadex,exitthread.... etc..(i did not used .net runtime Tread class)
but the most they can do is to set thread exit code,
i want to know how to terminate child thread from parent thread, any API or tutorials will be helpful,,
thanks in advance
WIreD 0x90
|
|
|
|
|
Actually, you really don't want to forcibly terminate your thread. You should monitor something in your thread proc that will exit when the state is set by the parent thread.
One way of handling this is to create an event, say, m_hShutdown. At the top of your thread proc loop, do a WaitForSingleObject on m_hShutdown with a short timeout. When the event is set, exit the thread proc and your thread will terminate normally. In your parent code, simply call SetEvent(m_hShutdown) when you're ready to terminate the child thread.
Hope this helps.
|
|
|
|