fgets2 C# reading from stdin using readline function Below link should be referred to. https://docs.microsoft.com/ko-kr/dotnet/api/system.console.readline?view=net-6.0 Console.ReadLine 메서드 (System) 표준 입력 스트림에서 다음 줄의 문자를 읽습니다. docs.microsoft.com Another link https://www.geeksforgeeks.org/console-setin-method-in-c-sharp/amp/ Console.SetIn() Method in C# - GeeksforGeeks The Console.SetIn() method is used to set the In property of the specified Stream.. 2022. 6. 20. C 언어에서 한 줄 읽어 들이기 C 언어에서 한 줄의 문자열릏 읽어 들이고 싶은 때가 있다. gnu 컴파일러를 사용한다면, getline을 사용할 수도 있다. scanf 함수를 이용할 수도 있으나, fgets를 사용하는 것이 가장 좋을 것 같다는 개인적인 생각이다. fgets 함수는 사용자가 입력한 엔터키 까지 읽어들이기 때문에, 맨 마지막의 '\n' 문자를 제거해 주어야 한다. 이방법 또한 몇가지가 있다. strcspn을 이용한다든지, strchr을 이용한다든지 또는 strlen을 이용하는 방법도 있다. 여기서는 sscanf를 이용하는 방법을 소개하고자 한다. #include //#include int main() { char s[80]; puts("Enter your addres, for example 'New York'"); fg.. 2020. 12. 14. 이전 1 다음