I was guessing that was the case. Turns out it isn't. wsprintf DOES have a 1024 limit. sprintf does not.
Here's a little test:
Code:
#include <windows.h>
#include <stdio.h>
int main()
{
// Create a really large buffer...
char szBuffer[4096] = {0};
// Fill 100 elements with consecutive letters (0-99=A, 100-199=B,..., 2500-2599=Z)...
for (int i = 0; i < 26; i++)
for (int j = 0; j < 100; j++)
szBuffer[i * 100 + j] = 65 + i;
// End the string at the 2600th element...
szBuffer[2600] = 0;
// Display the string...
printf("Original String\n%s\n\n", szBuffer);
// Now, copy the string using sprintf/wsprintf...
char szBuffer2[4096];
wsprintf(szBuffer2, "%s", szBuffer);
// Display the new string...
printf("New String:\n%s\n\n", szBuffer2);
return 0;
}
You'll find that the original string is printed in its entirety. The new string, however, ends at the 24th K.
K = 10th letter...
10 * 100 elements/letter = 1000...
Add the 24...
1024 elements copied into new buffer.
If you change the wsprintf line to use sprintf instead, it works fine.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
this doesnt send mail to abv address...plz tell me some details abt last arguement ..is it a .txt file?if yes,shud i give full path of that file on my computer?or i what else shud i enter there?
plzzzzzz reply.
Originally posted by sushb4u
this doesnt send mail to abv address...plz tell me some details abt last arguement ..is it a .txt file?if yes,shud i give full path of that file on my computer?or i what else shud i enter there?
plzzzzzz reply.
Well...it sends the mail correctly, however the body is somehow empty...I need to test this further I guess...sorry about that...
Ciao, Andreas
"Software is like sex, it's better when it's free." - Linus Torvalds
all abv programs need name of smtp server...but i have only email address of receipent...so does anybosy know function or api to get smtp server name from given email address??or else can i use any standerd smtp server for any email id?if yes...plz tell me which smtp server i can use.
Normally you would send email through your smtp server for your ISP/email account unless you are trying to hide your email address/identity/IP address. Many ISP's are not accepting email directly from a person to their smtp server unless they have a email account on that server. Many ISP are checking origin of email and if it is not from a registered email server(IP address) it won't relay email or accept the mail. With 80% of email today as spam ISP's are cracking down on people using their resources for someone elses gain.
So just send the email through your ISP's smtp server and all will work just fine.
HTH
Jim
ATP BE400 CE500 (C550B-SPW) CE560XL MU300 CFI CFII
"The speed of non working code is irrelevant"... Of course that is just my opinion, I could be wrong.
"Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan 'press on' has solved and always will solve the problems of the human race."...Calvin Coolidge 30th President of the USA.
hi...thanz a lot...but i m sorry..i didnt get much..(
what do u mean by
"Normally you would send email through your smtp server for your ISP/email account "
ya i dont want to hide senders email address or identity...but user can enter any email id in from and to fields....so how can i get smtp server for that account's ISP??
ya i dont want to hide senders email address or identity...but user can enter any email id in from and to fields....so how can i get smtp server for that account's ISP??
If this is the case then you would have the user enter their smtp server address. As with most ISP's today in order to send email through their smtp server you must have a email account and log on with a user id and password this keeps people from using false return email address and using their smtp servers to relay SPAM.
Jim
ATP BE400 CE500 (C550B-SPW) CE560XL MU300 CFI CFII
"The speed of non working code is irrelevant"... Of course that is just my opinion, I could be wrong.
"Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan 'press on' has solved and always will solve the problems of the human race."...Calvin Coolidge 30th President of the USA.
If this is the case then you would have the user enter their smtp server address.
user's stmp server address means which address?? i mean suppose i m not asking for from id (it is fixed) and i m asking for only "To" address...and user entered "abc@yahoo.com" and suppose my from id is "me@mycomp.com" then i have to use which smtp server? server for input email address or server for mycomp's address?
i m sorry if i m creating some confusion...but plz reply
"To" address...and user entered "abc@yahoo.com" and suppose my from id is "me@mycomp.com" then i have to use which smtp server? server for input email address or server for mycomp's address?
You would use the smtp server for "me@mycomp.com", you use the smtp server of the senders address.
Jim
ATP BE400 CE500 (C550B-SPW) CE560XL MU300 CFI CFII
"The speed of non working code is irrelevant"... Of course that is just my opinion, I could be wrong.
"Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan 'press on' has solved and always will solve the problems of the human race."...Calvin Coolidge 30th President of the USA.
Bookmarks