Is there any way to get a line from a file and turn it into an int?![]()
like:
ifstream.getline(int);
This is a discussion on Getting an int from a file within the C++ Programming forums, part of the General Programming Boards category; Is there any way to get a line from a file and turn it into an int? like: ifstream.getline(int);...
Is there any way to get a line from a file and turn it into an int?![]()
like:
ifstream.getline(int);
#include <stdio.h>
...
fscanf(filepointer,"%d",&integer);
He used the c-style stream method. If it is an int, why not just do
Code:int variable; ifstream input("file.txt"); input>>variable;
Because i want to read one of the lines from the file not the whole file.