G
G
Gagatyn2016-09-16 10:23:38
C++ / C#
Gagatyn, 2016-09-16 10:23:38

How to display the numbers that are in the text in the file?

There are numbers in the text, they need to be displayed, how to do this?

ofstream file;
file.open("C:/Users/Desktop/text.txt");
  ofstream file;file << "8ы м0л0дцы! ТекстТекстТекстТекст 01 01";
  file.close();

  char buff[80];
  ifstream fin("C:/Users/Desktop/text.txt");

  fin >> buff;
  cout << buff << endl;

  fin.getline(buff, 80); 

  fin.close();
  cout << buff << endl;

This method does not work, swears at ">>" data type float/int/double

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Victor Marquardt, 2016-09-16
@Gagatyn

Try checking each character with
if (typeid(std::int)==typeid(yourVariable)
{
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question