sscanfUL()

The function imports a string in formatted form. The function works like the function sscanf() but changes to the current user language before reading the string.

Synopsis

int sscanfUL(string s, string format, <type1> &var1 [,<type2> &var2 ...]);

Parameter

Parameter Description
s String to be read
format Format to be read
var1, var2, ... Target variables

Errors

missing/incorrect arguments

Description

The function imports a string in formatted form. The function works like the function sscanf() but changes to the current user language before importing the string so that language dependent elements of format signs such as time data is formatted based on the set language. The change of the user language only applies to the respective process (meaning to the function sscanfUL) and not to the whole Windows language. For more examples and description of the format signs see chapter sprintf().

Example

Writes the value of the int variable i to the string s.

main()
{
  string s;
  int i=123;
  DebugN(sprintfUL(s, "%d", i)); 
  // Number of the characters output = 3
  DebugN(s); // s now contains "123"
  i=999;
  DebugN(sscanfUL(s, "%d", i)); // Read from s as int
  DebugN(i); // Again 123
}
main()
{
  string s;
  float i= 6.99;
  sprintfUL(s, "%5.3f\n", i); /* Writes the value of float
  parameter i to the string parameter s (formats a float to a
  string). */
  DebugN(s); //s = 6.99
  i=3.55; //changes the value of the variable i
  DebugN(s);
  DebugN(sscanfUL(s, "%f", i));//reads the value of parameter
  s
  DebugN(i); /* the value of i = 6.99 since the sscanf reads the
  value of parameter s and saves the value in the parameter i
  */
}

The fscanfUL() is used like sprintf(). For more different examples of using fscanfUL(), see chapter sprintf().

Assignment

Strings

Availability

CTRL