c++ read char from file, convert to long long int -


This is currently my function

  long int file :: Getline3 (int User1 , Long int user3) {std :: string filename = std :: to_string (user1); Std :: ifstream wings (file name + ".txt"); Fin.gate line (line1, 5); Fin.gateline (line2, 5); Fin.getline (line3, 20); Fin.close (); User3 = (Atoi (line3)); User 3 Return; }  

Most numbers seem to be back, but not all, and in a messy format.

Not sure if my error line is being read (

(line 1, line 2 and line 3 characters are declared in header file)

line 3 16 digits

/ code>

I think that is long int Should not be atoi , but strtoll :

  longer int strtoll (const char * nptr, char ** endptr, int base );  

supposingly line3 is a string, you can use it as:

  char * endptr = NULL; User3 = Strat L (line 3 cd_st (), and endapter, 10);  

and you can also mark it as c ++ :

After your comment : Strow a const char * Code> long int If the enterprise NULL , strtoll () is not there then in * endptr Stores illegal character addresses. You can also specify the base for the number.

You did (atoi (line3)); but atoi is also expected to be a const char * , so I think line3 a std: with a shot in the dark. > You can of course use atoll for long code):


Comments