Sure! Below is a Python function that generates test cases for the problem statement you provided. This function will randomly generate values for \( K \) and \( S \) within the specified constraints.

```python
import random

def tcgen():
    # Length of the string S
    length = random.randint(1, 100000)
    
    # Generate a random string S of digits between 1 and 9
    S = ''.join(random.choice('123456789') for _ in range(length))
    
    # Generate a random integer K such that 0 ≤ K < |S|
    K = random.randint(0, length - 1)
    
    return K, S

# Example usage
for _ in range(5):
    K, S = tcgen()
    print(f'K: {K}\nS: {S}\n')
```

### Explanation:
1. **Length of \( S \)**: The length of the string \( S \) is randomly chosen between 1 and 100,000.
2. **String \( S \)**: The string \( S \) is generated by randomly selecting digits between '1' and '9' for each position in the string.
3. **Value of \( K \)**: \( K \) is randomly chosen such that \( 0 \leq K < \text{length of } S \).

This function ensures that the generated test cases adhere to the constraints provided in the problem statement.

### Example Output:
The example usage shows how you can generate multiple test cases and print them. Each output will have a random \( K \) and a corresponding random string \( S \).

```plaintext
K: 5123
S: 918273645918273645...

K: 23456
S: 123456789123456789...

K: 99999
S: 987654321987654321...

...
```

Feel free to run the function and adjust it as needed for your specific testing needs.