File input/output question. (C/C++)

Asked 2 years ago, Updated 2 years ago, 33 views

I tried file input/output for the first time today, but it's hard, so I'm asking you a question! I'm trying to get the year and month and print it out in the form of a calendar It's saved according to the txt file I'm trying to read it into the console window through ifstream, but it's not working properly. I'd appreciate it if you could tell me the problem ㅜ

Ifstream is like this.

I think I did a good job saving it in my notepad like a picture That's what the console window looks like that

c++ c io

2022-09-22 12:16

1 Answers

The second parameter in getline is to determine how many characters to read. The text file seems to have more than 100 characters, so try increasing this value.

Like inFile.getLine(inputString, 1000).


2022-09-22 12:16

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.