Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Telix/SALT v3.15 & RS-232, Hayes - <b>subchr</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  SUBCHR

  .  Summary

  subchr(str <s>, int <pos>);

  .  Description

  The subchr function returns the character found at position <pos> in
  string <s>. Note that an integer (representing the ASCII value of
  the character) is returned, not a string. <pos> may be anywhere
  within the string length as defined. Note that positions start from
  0. The 1st character in a string is at position 0, the 40th at posi-
  tion 39, etc. A string defined with a length of 10 would have valid
  positions of 0 to 9, with position 10 always returning the 0 value
  that terminates all strings.

  .  Return Value

  An integer value as described above.

  .  Example

  // This will print out the contents of a test string, extracting
  // each character individually, and stopping when a 0 is reached
  // which marks the end of all proper strings

  int i;
  str s[] = "This is a test string";
  for (i = 0; subchr(s, i) != 0; ++i)
   printc(subchr(s, i));

See Also: setchr subchrs

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson