MultiByteToWideChar, sprintf, sprintf_l, strcat, strchr, strcmp, strcmpi, strcpy, StrExchangeChar, stristr, strlen, strlwr, strrchr, strstr, strupr, WideCharToMultiByte
Description
MultiByteToWideChar( charwchar_str
, charchar8_str
);
This function maps a character string to a wide character string.
Parameters
See Also
WideCharToMultiByte
Description
StrExchangeChar( char *Int_str1
, intInt_Char1
, intInt_Char2
);
This function replaces all occurrences of a character within the specified string.
Parameters
//When running an external program, quotation marks cannot be used inside a variable, //we will use a dollar sign instead. char txt[1000]; char ImageJ[260] = "$C:\Fiji.app\ImageJ-win32.exe$"; char ImageJmacro[260] = "$nis.ijm$"; strcat(txt, ImageJ); strcat(txt, " -batch "); strcat(txt, ImageJmacro); StrExchangeChar(txt, 34, 36); //Exchange dollars for qotation marks - ASCII codes: 36 = [$], 34 = ["] WaitText(0, txt); Int_ExecProgramWait(txt); //Call the program and wait for it to finish WaitText(0, "DONE");
Description
WideCharToMultiByte( charchar8_str
, charwchar_str
);
This function maps a wide character string to a new character string.
Parameters
See Also
MultiByteToWideChar
Description
sprintf( char *Int_Buffer
, char *Int_Format
, char *Int_Arguments
);
This function formats and stores a series of characters and values in the string variable buffer. Each argument in Int_Arguments (if any) is converted and output according to the corresponding format specification in formatSpec.
Parameters
Int_Arguments
Specifies zero or more optional arguments in a string, separated by commas. The number and type of the optional arguments depend on the corresponding format-control character sequences specified in the formatSpec parameter. When arguments is an empty string, formatSpec will be copied to buffer, including legal format specifications.
// sprintf example - shows how a character, tab, CR and float numbers are converted to output string. char output[80],filename[80],title[80]; // the correct format specifier should look like this: sprintf(buf,"Z position = %.3f","zpos"); // %.3f - means floating point value formated with precision to three digits after the decimal point. // Trailing zeros are truncated. The precision is variable, you can change it. // Use %-.3f to keep trailing zeros in place, which results in something like this: "Z position = 12.400" Get_Filename(FILE_IMAGE,filename); Get_FileTitle(title,filename); sprintf(output,"API Example - sprintf function. Last opened image: %s","title"); Int_CreateTextWindow(output,0,RGB(0,0,128),RGB_WHITE,100); Wait(2); sprintf(output, "Uppercase 'A' : %c\nTab:\t\t\t Third Tab \n CR:\n\nProgram: %s A\nquarter: %-07.3f ","65, `NIS-Elements`, 1/4"); Int_CreateWindow(WND_1,"sprintf example",0, 0, 0, 450, 560,"Header:\n\n",1,1,0.00000,1,1,1,"Arial,B,8"); Int_SetWindowText(WND_1, output, TRUE); Int_CloseTextWindow();
Note
%[flags] [width] [.precision] type - Only % and type are obligatory. Any text in formatSpec which does not belong to a legal format specification will simply be copied to buffer. Each field of the format specification is a single character or a number signifying a particular format option. The simplest format specification contains only the percent sign and a type character (for example, %s). The optional fields, which appear before the type character, control other aspects of the formatting. The fields in a format specification are described as follows: Optional character or characters that control justification of output, blanks, leading zeros and hexadecimal prefix. More than one flag can appear in a format specification. - (minus)Pad the output value with blanks or zeros to the right to fill the field width, aligning the output value to the left. If this field is omitted, the output value is padded to the left, aligning it to the right. With floating point numbers, trailing zeros up to precision are generated. Note that right alignment of numbers or text is only handled correctly when using a proportional font. 0 (zero) Pad the output value with zeros to fill the field width. If this field is omitted, the output value is padded with blank spaces. With floating point numbers, leading zeros up to width are generated. Required character that determines whether the associated argument is interpreted as the ASCII-code for a character (c), a literal string enclosed in backquotes or a string variable (s), an integer or -variable (d or i), a floating point number or -variable (f ) or a hexadecimal number or -variable (x). Floating point numbers will be represented in exponential format if the exponent is -4 or lower and there will be no loss of accuracy, or if the exponent is 15 or higher. Integer- and hexadecimal values which absolute value exceeds 2,147,483,647 are truncated.
See Also
atof, strcat, strcmp, strcmpi, strcpy, strlen, strlwr, strrchr, strupr, memcmp, memcpy, memset
Description
sprintf_l( char *Int_Buffer
, char *Int_Format
, char *Int_Arguments
);
This function equals the sprintf function but is region-dependent. If a number is included in the string, the decimal symbol ("," or ".") will be corrected according to the regional and language settings of your operating system.
Parameters
Int_Arguments
Specifies zero or more optional arguments in a string, separated by commas. The number and type of the optional arguments depend on the corresponding format-control character sequences specified in the formatSpec parameter. When arguments is an empty string, formatSpec will be copied to buffer, including legal format specifications.
See Also
sprintf
Description
strcat( char *str1
, char *str2
);
This function appends str2 to str1, terminates the resulting string with a null character, and returns a pointer to the concatenated string str1. This function operates on null-terminated strings. The string arguments to these functions are expected to contain a null-byte, marking the end of the string. No overflow checking is performed when strings are copied or appended.
See Also
atof, sprintf, strcmp, strcmpi, strcpy, strlen, strlwr, strrchr, strupr, memcmp, memcpy, memset
Description
strchr( char *str
, intvalue
);
This function returns a pointer to the first occurrence of value (converted to char) in str1. The converted character value may be the null character ; the terminating null character of str1 is included in the search. The function returns NULL if value is not found. strchr operates on null-terminated strings. The string arguments to this functions is expected to contain a null-byte, marking the end of the string.
See Also
atof, strcat, memcmp, strcmp, strcmpi, strcpy, strlen, strlwr, strupr, sprintf, memcpy, memset
Description
strcmp( char *str1
, char *str2
);
This function compares str1 and str2 lexicographically.
Return Values
See Also
atof, strcat, memcmp, strcmpi, strcpy, strlen, strlwr, strrchr, strupr, sprintf, memcpy, memset
Description
strcmpi( char *str1
, char *str2
);
This function compares the two strings. The comparison is not case-sensitive.
Return Values
See Also
atof, strcat, memcmp, strcmp, strcpy, strlen, strlwr, strrchr, strupr, sprintf, memcpy, memset
Description
strcpy( char *str1
, char *str2
);
This function copies str2, including the terminating null character, to the location specified by str1, and returns str1. The string arguments to this function is expected to contain a null-byte, marking the end of the string. No overflow checking is performed when strings are copied or appended.
See Also
atof, strcat, memcmp, strcmp, strcmpi, strlen, strlwr, strrchr, strupr, sprintf, memcpy, memset
Description
stristr( char *Int_str1
, char *Int_str2
);
This function finds the first occurrence of a substring within a string. The comparison is case insensitive.
Description
strlen(
char *str
);
This function returns the length, in bytes, of str, not including the terminating null-byte.
See Also
atof, strcat, memcmp, strcmp, strcmpi, strcpy, strlwr, strrchr, strupr, sprintf, memcpy, memset
Description
strlwr(
char *str
);
This function converts characters to lowercase ones.
See Also
atof, strcat, memcmp, strcmp, strcmpi, strcpy, strlen, strrchr, strupr, sprintf, memcpy, memset
Description
strrchr( char *str
, intvalue
);
This function returns a pointer to the last occurrence of value (converted to char) in str. The converted character value may be the null character, the terminating null character of str is included in the search. The function returns NULL if value is not found. This function operates on null-terminated strings. The string arguments are expected to contain a null-byte, marking the end of the string.
See Also
atof, strcat, memcmp, strcmp, strcmpi, strcpy, strlen, strlwr, strupr, sprintf, memcpy, memset
Description
strstr( char *Int_str1
, char *Int_str2
);
This function finds the first occurrence of a substring within a string. The comparison is case sensitive.