Hi, I am trying to make a program that writes and reads data from a file, and I am trying to read a number from a file and store it in a variable of type int.
Data is the name of the file I opened, and temp is a temporary variable of type string since getline() only accepts type string for a parameter. I tried type casting from string to int but that doesn't work either. Is there any way to get a number from a file and store it as an int?
Ok thanks I'll get working on that in a bit. New problem though - we recently learned stuff with structures and such. But for some reason when I make a array of a structure, and try to edit a member of it in a .h file, it doesn't work. I know that's a bit confusing the way I said it, here:
is just one of the errors I get. Line 120 is: results[result].name = content[ref+0];
That line is in a file called "struct.h." There are no other problems with the program as I have run it before this edit. All the variables you see are declared and perfectly valid.