Read stdin character by character C++ [duplicate] - c++

This question already has answers here:
How do I input variables using cin without creating a new line?
(7 answers)
Closed 7 years ago.
in my Windows Console application I have to read characters from stdin without waiting for newline (press Entrer).
I tried out get, getchar and tons of other solutions, but this question still open for me. Can anybody help me, how I can reach it?

It's _getch (or _getche if you want character echoing). Include <conio.h>.

Related

One or more unexpected \r (^M) found;better to use only a \n [whitespace/newline] [1]? [duplicate]

This question already has answers here:
What flag silences GCC's warning about no newline at file-endings?
(6 answers)
Closed 2 years ago.
Whenever I am compiling my cpp file on LMS and in return Style error is coming with this sentence. One or more unexpected \r (^M) found;better to use only a \n [whitespace/newline] [1]??
Sounds like your compiler is complaining about CRLF-encoded files (DOS/Windows) instead of LF-only, as per UNIX/POSIX conventions.
You may need to adjust your editor to save in the correct format.

Handling CSV file [duplicate]

This question already has answers here:
C++ CSV line with commas and strings within double quotes
(3 answers)
Closed 5 years ago.
I am using CSV file with comma as delimiter
getline(strGetLine, word, ',')
I have a problem while reading something which as comma in between
Example -"mysentence,fromCSV"
Please let me know how to handle it.
I would recommend using a library, since this is not a new problem and has been solved several times.
The first example I can find is https://github.com/ben-strasser/fast-cpp-csv-parser, but you could also do something with Boost Spirit if you felt inclined.

Check platform and use the correct printf form [duplicate]

This question already has answers here:
How to detect reliably Mac OS X, iOS, Linux, Windows in C preprocessor? [duplicate]
(3 answers)
Closed 8 years ago.
It's been 10 years since I've learned C++ during high school, now I'm playing around it again and I'll already facing some problems regarding multi-platform.
I saw that if I want to display special characters on windows, I should use wprintf. However, on *nix systems, it is not necessary.
So, how can I detect what is the current platform, so I can run printf or wprintf depending on it?
UPDATE
I'll open a new question with the error and close this one.
You could simply use wprintf (or wcout <<) on either platform. See this question for an example.

Work with File in windows [duplicate]

This question already has answers here:
How can we check if a file Exists or not using Win32 program?
(9 answers)
C++: Which is the best method of checking for file existence on windows platform [duplicate]
(11 answers)
Closed 9 years ago.
I need a function in c++ to check if a given path/filename exists on the computer.
Can anyone help me?
This could be another possibilty besides the ones from the comments
PathFileExists

How to delete some contents from a file [duplicate]

This question already has answers here:
Delete a character from a file in C
(5 answers)
Closed 9 years ago.
I need to delete some starting contents from a text file.
Is there any way to do this.
I tried but i am not able to find any solution for this
Please help me
Thanks,
You can use external system tools to do that. In c++, such utilities can be launched using the function system()