|
char array[4][7] =
{
{"zero\0"}, {"one\0"}, {"two\0"}, {"three\0"}
};
puts(array[2]);
Jeremy L. Falcon
"Tickle me Elmo -- please!"
<nobr>
Homepage : Sonork = 100.16311 Maybe my mangling might misguide malicious miscreants momentarily?
|
|
|
|
|
hi, sorry to bother you again, but it still comes up with the same errors
damsel in distress
|
|
|
|
|
It's giving you a syntax error? Could you post the code (if it's not millions of lines that is) so I could have a run-through?
Jeremy L. Falcon
"Tickle me Elmo -- please!"
<nobr>
Homepage : Sonork = 100.16311 Maybe my mangling might misguide malicious miscreants momentarily?
|
|
|
|
|
|
Jeremy Falcon wrote:
Reveal thyself ye swine or thus not an answer from me you will receive!
Sounds as if a Shakespearian plea for the anonymous to become a user
Nick Parker
|
|
|
|
|
Inside a DLL, Can I find which process is calling the dll ? Thanks
|
|
|
|
|
|
How about a bit more info:
If you want the process name use GetModuleFileName()
If you want the PID use GetCurrentProcessId()
|
|
|
|
|
GetModuleFileName() worked. Thank You!
|
|
|
|
|
Can you use a string object.
Ex. CString str;
str.Format("%d", nNumbers);
str.GetLength();
|
|
|
|
|
How about capture keystrokes ?
|
|
|
|
|
or you can use this approach:
char buff[6];
int i = 2632;
int len;
sprintf(buff, "%i", i);
len = strlen(i);
|
|
|
|
|
or you can use a simpler aproach:
int len
if (i < 10)
len = 1;
if (i < 100 and i > 9)
len = 2;
if (i < 1000 and i > 99)
len = 3;
if (i < 10000 and i > 999)
len = 4;
if (i < 100000 and i > 9999)
len = 5;
very simple, but since you can't use conversions, i'd use that one.
|
|
|
|
|
Try this -
int get_NumDigits(int x)
{
return (int) (1+log10(abs(x)));
}
Vivek
|
|
|
|
|
Thats a nice solution except of course what if x is 0?
Log10(0) = error!
if (x != 0)
return (int)(1 + log10(abs(x))) ;
else
return 1 ;
}
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Yes,
thats a good safe check. the code wont crash but will report num digits in zero to be zero.
Roger Allen wrote:
return 1 ; // 0 is 1 digit wide
Maybe from a printing point of view, but I think from a math viewpoint, num digits in zero = zero. (if you define num digits of an integer to be the number of times you have to divide the integer by 10 to get a value to zero)
I better get back to work ..
Vivek
|
|
|
|
|
You could just divide by 10 in a loop and count how many times you executed the loop until the result was zero.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
int val;
int len = 0;
for (int i = val;i;i = i / 10)
len++
|
|
|
|
|
count how many times you can divide by ten before you get a 0 answer.
-c
<font size=-2>
o(int O){putchar(O);}main(){float _[8],O,I=.05;char l;for(_[6]=15;_[6]<':';o
(10),_[5]=-'$'*I+_[6]++*I)for(_[7]=-5;_[7]<'@';_[4]=-'('*I+_[7]++*I,o(l?'?':':'))
for(*_=O=0,l=1;++l&&((_[2]=*_**_)+(_[3]=O*O)<4);O=*_*O+_[5]+O**_,*_=_[2]-_[3]+_[4]);}</font>
|
|
|
|
|
Chris Losinger wrote:
count how many times you can divide by ten before you get a 0 answer.
... then add 1.
J
"I am wise enough to therefore not spout my ill informed opinion as if it were remotely related to fact." - Christian Graus
|
|
|
|
|
numDigits = 1; while (intNumber /= 10) ++numDigits;
ar
|
|
|
|
|
I have a COM dll and VC++6 IDE hangs while performing registration. I even tried registering using "regsvr32" from command prompt and still no luck. I see the process "regsvr32" in the task manager and it's idle...
Any pointers. Thanks.
|
|
|
|
|
I found the problem..
After completing the build process, VC registers the COM dll. ie it makes a call to DLLRegisterServer(). I overrided the "InitInstance" and the code in Initinstance is resposible for this problem. I have deleted my code from InitInstance() every thing works fine.
|
|
|
|
|
Hello,
I need a bit of help writing a batch file. In the line below where I have %1 instead of reading only one word I need to to read an entire string. So to do this I persume that I'll have to read the string from a file. So my question is how do I tell it to read from the file. Lets say the line I need to read is in c:\line.txt
echo %1 | C:\myexecutable --sendsms %2
Thanks.
Aoife
|
|
|
|
|
I have made an app in Visual C++, but i can't move or close it, it's like it doesen't react on mouseclicks (but the controls on the window works fine). however, the only thing that doesen't seem to work is mouseclicks on the app, when i right click on the app in the taskbar and press the "Move" menu item and then move it, it works, and the close command also works in that menu... here's the winmain code:
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MSG msg;
ghWnd = CreateDialog (hInstance, MAKEINTRESOURCE(IDD_MAIN), NULL, WndProc);
ShowWindow (ghWnd, SW_SHOW);
UpdateWindow (ghWnd);
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg);
DispatchMessage (&msg);
}
return msg.wParam;
}
and here's the WndProc:
BOOL CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_DESTROY:
RegSave(hWnd);
PostQuitMessage (0);
break;
default:
return DefWindowProc (hWnd, uMsg, wParam, lParam);
break;
}
return (0L);
}
anyone know what could be wrong?
thanks all!
|
|
|
|