|
My feeling exactly.
I this whoever posted the code missed something.
Here is their sample use of the function.
int main( void ) {
my_printf( "sdc", "This is a string", 29, 'X' );
return( 0 );
}
This code displays the following output when run:
Printing a string: This is a string
Printing an integer: 29
Printing a character: X
Now where is the "sdc" print?
And I thought that "format" was some kind of special feature.
I guess I ditch this, maybe I can figure out how to use templates.
Thanks
|
|
|
|
|
|
As per what Richard said READ THE MANUAL.
"sdc" is the format specifier for the three parameters that follow
s = STRING
d = Signed decimal integer
c = Character
"This is a string" they want displayed as a string
29 they want displayed as a decimal
X they want displayed as a character
Try changing changing "sdc" to "s%.3fc" and watch the output
%.3f is a complex format it means write value as a float to 3 decimal places.
So we still have 3 instructions s + %.3f + c
So the first string is a FORMAT STRING it tells the print function what to do with the following data passed in.
In vino veritas
|
|
|
|
|
Thanks for reply, figured it out myself, but did not have time to reply.
As far as your first sentence goes, take a refresher course and read "how to answer the question".
You reply was great, but you do not have to be so snippy about it.
GOT MY POINT?
Have a swell day.
|
|
|
|
|
i use ncrack and in installed all this(visual studio 2005,2008,2010,2013) so ncrack working with visual c++. im wondering how can i create more threads?i foudn this but i don't know how to apply!I must open visual c++?create project?
<a href=""><a href="http://msdn.microsoft.com/en-us/library/ms682516(VS.85).aspx">Creating Threads (Windows)</a>[<a href="http://msdn.microsoft.com/en-us/library/ms682516(VS.85).aspx" target="_blank" title="New Window">^</a>]</a>
|
|
|
|
|
Member 11189357 wrote: must open visual c++?create project? Yes, because threads can only exist within an executable program. However, your question or problem is far from clear.
|
|
|
|
|
Try this:
#include "stdafx.h"
#define _MT
#include <windows.h>
#include <process.h> /* _beginthread, _endthread */
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#pragma comment(lib, "user32.lib")
#pragma comment(lib, "libcmt.lib")
#pragma comment(linker, "/NODEFAULTLIB:libcd.lib")
void ThreadFunction1(void *ch);
void ThreadFunction2(void *dummy);
BOOL repeat = TRUE;
int main(){
printf("\nMultithreading with two threads.\n\n");
printf("Thread Function 2 listens for key strokes. \n");
printf("Thread Function 1 does all the other work \n");
printf(" \n");
CHAR ch = 'A';
_beginthread(ThreadFunction2, 0, NULL);
while (repeat){
_beginthread(ThreadFunction1, 0, (void *)(ch++));
Sleep(1000L);
}
printf(" \n");
return 0;
}
void ThreadFunction2(void *dummy){
_getch();
repeat = 0;
}
void ThreadFunction1(void *ch){
while (repeat){
Sleep(100L);
}
_endthread();
}
|
|
|
|
|
For windows right?so this source will work for ncrack force bruter right?I don't know how to sue this code?must open visual c++ ?
-- modified 24-Sep-16 9:39am.
|
|
|
|
|
|
yes i use 20-30 threads if i use more i receive errors,nsock timeouts! nsock errors! etc...so i need to put that code somewhere but i don't know how?
|
|
|
|
|
Member 11189357 wrote: i need to put that code somewhere but i don't know how? And you think maybe we can guess? We have no idea what your code is supposed to be doing, or what you are trying to achieve with these threads.
|
|
|
|
|
ncrack -vv -d7 --user admin -P list1.txt 81.196.251.12:3389,CL=20,cd=320ms -oN good.txt -f
CL=means maximum threads 20 , becouse if i use more...i receive nsock errors
tools i use are ( ncrack +visual c++)
-- modified 24-Sep-16 10:27am.
|
|
|
|
|
So you are trying a brute force attack on a site via the remote desktop access (port 3389) as user admin with a set dictionary of passwords, and you want us to help you??????
There is no good or legal reason you would need to do such a thing, so that leaves only illegal.
Not going to happen
Interesting target: RIPE Network Coordination Centre
descr: RCS & RDS Residential
descr: City: Bucuresti
In vino veritas
modified 24-Sep-16 13:57pm.
|
|
|
|
|
i use a sock 5 to connect so that's not my real IP, what ur tryng to proove?that ur superman?
|
|
|
|
|
Good to see you aren't stupid enough to be trying to develop something illegal and give up your own IP ... gratz you get a +1 for IQ in my books and the the authorities may not kick in your door one evening.
In vino veritas
|
|
|
|
|
|
I had a feeling that was the case, but could not be certain. Thanks for your comments.
|
|
|
|
|
It sounds like you are wanting to know how to use a network authentication cracker. How exactly is this a C / C++ / MFC question?
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Note: prefer _beginthreadex over _beginthread.
If using C++11, you could use the std::thread class.
|
|
|
|
|
im having a problem here.. my program always output Invalid Gender! after I input the gender and status..
#include stdio.h>
/*Ambus*/
int main()
{
char stat[10], gend[10];
int rCTR, mmCTR, fsCTR;
clrscr(); mmCTR = 0; fsCTR = 0;
for (rCTR = 1; rCTR <= 10; rCTR++)
{
JJ:printf("\n Record %d \n",rCTR);
printf("Input your gender:"); scanf("%s",&gend);
printf("Input your civil status:"); scanf("%s",&stat);
if(gend == "female")
{
if(stat == "single")
fsCTR++;
else if(stat == "married");
else
{
printf("Invalid civil status!");
goto JJ;
}
}
else if(gend == "male")
{
if(stat == "married")
mmCTR++;
else if(stat == "single");
else
{
printf("Invalid civil status!");
goto JJ;
}
}
else
{
printf("Invalid gender!");
goto JJ;
}
}
printf("Single females=%d, Married males=%d, Number of Records=%d.", mmCTR, fsCTR, rCTR-1);
return 0;
}
|
|
|
|
|
if(gend == "female")
That is not a valid way to compare strings in C. You need to use one of the string compare functions: see strcmp, wcscmp, _mbscmp[^]. It is also a bad idea to use the goto statement, use loops instead.
|
|
|
|
|
You are comparing a character array (a pointer) with a pointer to a constant string:
if(gend == "female")
Those pointers will never be identical.
If you want to compare strings (the content pointed to by the pointers), you must compare each element (character) of the strings. There is the strcmp[^] C standard library function to do this:
if (!strcmp(gend, "female")) 
|
|
|
|
|
ohh.. i see.. thank you very much :3
|
|
|
|
|
I wonder: what IDE / compiler are you using? Isn't the debugging possible?
|
|
|
|
|
it is possible.. btw im just a beginner :3
|
|
|
|