|
Hiya,
I need to send images to a server and want to use Base64 encoding.
Is there currently a library that will do this for me?
Thanks,
garyc
|
|
|
|
|
The wikipedia entry for Base64[^] has links to implementations. Scroll down to the "external links" section.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
You may also write your own, it isn't a daunting task.
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
[My articles]
|
|
|
|
|
|
Hello,
I've got a question about variable argument list: Is there a possibility/what would be the best way to call a function with variable arguments, but the number and the type of the arguments is not know at compile time?
You could imagine the problem as follows ( printf is used here for simplicity):
You have an input txt file with the string and a variable number of parameters on each line:
e.g.
"id=%d, name=%s, age=%d" 1 "marci" 100
" a totally different string %d %d %c %x" 1 2 'Y' 10
" there is no rule, this string can be %s" "anything"
You have to use these inputs in the code as parameters for the printf function.
(e.g. for the first line printf("id=%d, name=%s, age=%d",1,"marci",100);
Thank you in advance,
yakabmarci
P.S. The resp. function is available as both as func(n,...) and func(n,va_list p)
|
|
|
|
|
i'd put the parameters into an array of strings. or, if you can derive all of your parameters from a common base type, put them into an array of CBaseType*s. then pass the array - it's cleaner than dealing with the varargs stuff.
|
|
|
|
|
i want to connect my application to all servers on LAN using TCP sockets.
UINT CD1MessageDlg::ScanLAN(LPVOID pParam)
{
unsigned int tf0, tf1, tf2, tf3;
CString tip = "";
CD1MessageDlg *t;
t=(CD1MessageDlg*)pParam;
BOOL x = 1;
for (tf0 = 192; tf0 <= 192; tf0++)
{
for (tf1 = 168; tf1 <= 168; tf1++)
{
for (tf2 = 109; tf2 <= 117; tf2++)
{
for (tf3 = 1; tf3 <= 255; tf3++)
{
tip.Format("%u.%u.%u.%u", tf0, tf1, tf2, tf3);
t->m_sConnectSocket.Connect(tip, 50000);
}
tf3 = 0;
}
tf2 = 109;
}
tf1 = 168;
}
return 0;
}
one more ques. can i reuse the same socket again and again for finding server as i'm doing in my this code.Future Lies in Present.
Manmohan Bishnoi
|
|
|
|
|
you probably can - but if you fail to connect your socket will 'block' for the timeout, so you may want to use a socket pool
furthermore,
Manmohan29 wrote: for (tf0 = 192; tf0 <= 192; tf0++) { for (tf1 = 168; tf1 <= 168; tf1++) {
loops are redundant, and in
Manmohan29 wrote: tip.Format("%u.%u.%u.%u", tf0, tf1, tf2, tf3);
you're not specifying a port - so what do you hope to connect to ?
|
|
|
|
|
Garth J Lancaster wrote: for (tf0 = 192; tf0 <= 192; tf0++) { for (tf1 = 168; tf1 <= 168; tf1++) {
loops are redundant
this code is for only testing purpose. i will modify my function to take ip address range from user.
Garth J Lancaster wrote: tip.Format("%u.%u.%u.%u", tf0, tf1, tf2, tf3);
you're not specifying a port - so what do you hope to connect to ?
i'm specifying port 50000
t->m_sConnectSocket.Connect(tip, 50000); Future Lies in Present.
Manmohan Bishnoi
|
|
|
|
|
Manmohan29 wrote: i'm specifying port 50000
my mistake - I had forgotten the Connect() parameters - I was thinking you were specifying the timeout ..
in which case, as I said, if you get a connect fail, you'll have to wait for the timeout for the socket to become available again I think ...
'g'
|
|
|
|
|
Consider the possibility to use "multicast" http://en.wikipedia.org/wiki/IP_multicast[^].
Check with your network administrator if this is possible in you environment, before spreading a potentially huge number of independent identical flows, or you may risk to sit down your network.
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
emilio_grv wrote: Check with your network administrator if this is possible in you environment
It is not possible in our college network as told by our N/W Admin.
Thanx. Future Lies in Present.
Manmohan Bishnoi
|
|
|
|
|
Hello all!
I am currently not the best programmer out there but am learning every day! I am faced with a small problem though, I know what my goals are and want to start focusing on them but im stuck choosing a compiler.
I want to do embedded arm development and move into linux arm based development and driver/gui development but at the same time I gotta face the fact that 90% of the market is windows based so I will need to be able to write windows programs to communicate with my devices. My questions is should I dive into gcc with a full linux distro and do all my development on that and then use say Visual Studio to write all my windows based client software?
Another option is to use windows exclusively and say minGW with Code::Blocks or even setup a GCC toolchain (one for windows and one for arm using Cygwin) and using wxWidgets and QT/SDL based code for portability.
The main issues is I am still a beginner and should I go all out with the environment or choose one compiler to stick with for now? Im worried that changing compilers (especially from a VS MFC setup to GCC) will be a large setback so why not start out on the end road eh?
Thanks!
|
|
|
|
|
You are worrying too much. Both VC++ and GCC are pretty stndard compliant these days and you won't have too much troubles switching from one to another.
|
|
|
|
|
Hi Member
I found keyboard hook example from codeproject.
Click here
[]
And follow these step
1.Copy KeyHook.h, KeyHook.dll, Keyhook.lib into your project directory, add KeyHook.lib into your workspace by "Project - Add to Project - Files", and include KeyHook.h where needed.
2.Call InstallKeyHook to install the hook.
3.Call AddKeyEntry to register key entries which consist of information on what kinds of keyboard events should be captured and whom should be notified.
4.Call GetKeyEventResult to retrieve information of the captured key events after your application window receives the notification messages, with values of the wParam and lParam unaltered.
5.Call UninstallKeyHook to release resources as soon as you've finished using the hook.
But Nothing happen.
I just want to get key when Key is press on application(
application may be notepad,word or internet explorer).please help me
|
|
|
|
|
You should post your question at the article's thread.
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
[My articles]
|
|
|
|
|
Hey!
I know your woes I had been looking for a keyhook library for quite some time when I found this one and after a month of playing with it I like it ALOT! Its way easier to use than others or writing my own. I am working on writing a consume function for it so that it captures key events and filters them.
I used it in a plugin for Mach3 CNC software but you can see how it works if you dig through my code at THIS POST[^]
Good luck!
|
|
|
|
|
Thanks for reply but it's not working.Can you give me some code example.Please help me it's very diffult for me..Please help
|
|
|
|
|
This is the relevant info from my project in the file: PluginTestDlg.cpp
<br />
#include "KeyHook.h"<br />
<br />
#define WM_MY_MESSAGE (WM_APP + 100)<br />
<br />
ON_MESSAGE(WM_MY_MESSAGE, OnMyMessage)
<br />
LRESULT lRes = InstallKeyHook();<br />
ASSERT(lRes == KH_OK);
<br />
KEYENTRY ke;<br />
ke.nMessage = WM_MY_MESSAGE;
ke.hCallWnd = m_hWnd;
ke.hHookWnd = 0;
ke.iCombKeys = 0;
ke.iIndicators = 0;
ke.iKeyEvent = KH_KEY_DOWN | KH_KEY_UP;
ke.iMinVKCode = 0;
ke.iMaxVKCode = 255;<br />
<br />
lRes = AddKeyEntry(&ke);<br />
ASSERT(lRes == KH_OK);
<br />
<br />
LRESULT CPluginTestDlg::OnMyMessage(WPARAM wParam, LPARAM lParam)<br />
{<br />
KEYRESULT kr; <br />
<br />
UINT nMask = KH_MASK_EVENTTYPE | KH_MASK_PRINTABLECHAR;<br />
<br />
LRESULT lRes = GetKeyEventResult(wParam, lParam, &kr, nMask);<br />
ASSERT(lRes == KH_OK);
<br />
if (kr.chPrintableChar != 0)<br />
{<br />
CString sEvent;<br />
if (kr.iKeyEvent == KH_KEY_DOWN)<br />
sEvent = _T("Key Down");<br />
else if (kr.iKeyEvent == KH_KEY_UP)<br />
sEvent = _T("Key Up");<br />
else if (kr.iKeyEvent == KH_KEY_REPEAT)<br />
sEvent = _T("Key Repeat");<br />
else<br />
ASSERT(FALSE);
<br />
CString sMsg;<br />
sMsg.Format(_T("Event: %s\nCharacter:%c"), sEvent, kr.chPrintableChar);<br />
MessageBox(sMsg);
}<br />
<br />
return (LRESULT)0;<br />
}<br />
<br />
<br />
UninstallKeyHook();<br />
-The ke structure is how you setup the hook and all options are documented in the KeyHook.h header
-In my kr structure I use the nMask to decode the message unto useful info then check if its a printable character and issue a msgbox for each type of key state.
-ASSERT(lRes == KH_OK);is a sanity check, error codes are listed in KeyHook.h
-#define WM_MY_MESSAGE (WM_APP + 100) I have no idea where I got this from... But it works...
Sorry to reply so late I have been away for work.
|
|
|
|
|
Please send me Vernam Cipher C code in esiest way, where user put the Plain text,key or cipher text.Actually i want to say where key is not generated randomly.
|
|
|
|
|
At a minimum, read #2 here."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Punima Sen wrote: Please send me Vernam Cipher C code
Try the quick answers, there is a GimmeCode tag. 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
[My articles]
|
|
|
|
|
People do not handover code here, they rather help others to write code themselves.
If code is what you're after, you could easily search Google for implementations of Vernam Cipher.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
hi everyone. Somebody can explain to me how to send or receive sms by using mfc-lib. I'll be Grateful for any help.modified on Saturday, February 20, 2010 9:43 AM
|
|
|
|
|
Did you search for a CodeProject's article? I found: "An SMPPLIB with COM Support".
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
[My articles]
|
|
|
|