Sign in to follow this  
Followers 0
meokey

translate memset, sprintf_s in C

3 posts in this topic

#1 ·  Posted (edited)

I came across C code like below and failed to translate it to autoit to get the value of buffx. Would you please help me out? Thanks a lot

#define UNIQU_HASH_SIZE 512

#define CLIENTKEY "%d%s%s%s"

...

char* szTerm2;

char* szTerm3;

int number = 0;

number=1234;

szTerm2="abc";

free(szTerm3);

memset(uniqueIDHash,0,UNIQU_HASH_SIZE);

sprintf_s(buffx, 4096, CLIENTKEY , number, szTerm2, szTerm3, uniqueIDHash);

Edited by meokey

Share this post


Link to post
Share on other sites



I came across C code like below and failed to translate it to autoit to get the value of buffx. Would you please help me out? Thanks a lot

#define UNIQU_HASH_SIZE 512

#define KEY "%d%s%s%s"

...

char* szTerm2;

char* szTerm3;

int number = 0;

number=1234;

szTerm2="abc";

free(szTerm3);

memset(uniqueIDHash,0,UNIQU_HASH_SIZE);

sprintf_s(buffx, 4096, CLIENTKEY , number, szTerm2, szTerm3, uniqueIDHash);

The equivalent in AutoIt would be

buffx = StringFormat(CLIENTKEY , number, szTerm2, szTerm3, uniqueIDHash)


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

The equivalent in AutoIt would be

buffx = StringFormat(CLIENTKEY , number, szTerm2, szTerm3, uniqueIDHash)

Thanks for your help.

Sorry, I missed a key info in the first post which is the buffx has to be 4096 bytes because it will be used to create a hash string -- will it make any difference in Autoit? Thanks

szHash = cmd5.GetMD5((BYTE*)buffx, strlen(buffx)).c_str();

Edited by meokey

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0