dynamic structure array
-
k, say i have a structure like struct MYSTRUCT { char somestring[64]; int number; int number2; }; now i would like to be able to write an array of this structure to a file and then it read it again, preferable with a non fixed length, would it be possible to do this?
-
k, say i have a structure like struct MYSTRUCT { char somestring[64]; int number; int number2; }; now i would like to be able to write an array of this structure to a file and then it read it again, preferable with a non fixed length, would it be possible to do this?
you can use CFile or FILE structures to print to file. Dynamic arrays are CArrays I think. (It's been a while :sigh:) More info on MSDN. If you don't have MFC then you can write your own CArray class which isn't that difficult. good luck. No hurries, no worries.
-
k, say i have a structure like struct MYSTRUCT { char somestring[64]; int number; int number2; }; now i would like to be able to write an array of this structure to a file and then it read it again, preferable with a non fixed length, would it be possible to do this?
Hello, Archer282 wrote: would it be possible to do this? Yes! Does:
std::ostream ostr;
/*
open file here
*/
for( int i = 0; i < nYourArraySize; i++ )
ostr << YourArray[i].somestring << YourArray[i].number << YourArray[i].number2;help? Behind every great black man... ... is the police. - Conspiracy brother Blog[^]