Skip to content

Conversation

@Brijesh-Thakkar
Copy link

This PR adds a Python-like input() function to stdlib_io.

Features:

  • Reads a full line from standard input
  • Optional prompt support
  • Preserves trailing whitespace
  • No implicit type conversion
  • Integrates with existing get_line infrastructure

Documentation, examples, and tests are included.
All CMake and ctest checks pass locally.

Fixes #259

Copilot AI review requested due to automatic review settings December 14, 2025 00:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a Python-like input() function to stdlib_io, providing a convenient way to read user input from standard input with an optional prompt. The implementation leverages the existing get_line infrastructure and follows similar patterns to other I/O functions in the module.

Key Changes

  • New input() function that reads a line from standard input with optional prompt support
  • Preserves trailing whitespace and returns an allocatable character string
  • Includes optional error handling via iostat and iomsg parameters

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

File Description
src/stdlib_io.fypp Adds the input_char function implementation and input interface, exports it in the public API
doc/specs/stdlib_io.md Adds comprehensive documentation for the new input function including syntax, arguments, return value, and usage notes
example/io/example_input.f90 Provides a basic usage example of the input() function
test/io/test_input.f90 Adds a test case for the input() function to verify whitespace preservation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Brijesh-Thakkar
Copy link
Author

@jvdp1 Heyy, Please review this pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Input() function

1 participant