compiler errors - C++ [Warning] converting to 'char' from 'double'... But I'm not...? -


i have own data structure defined:

struct data {     int partnumber;     char nameoftool[ 30 ];     int numinstock;     double priceper; }; 

and i've got function giving me problems:

void inputorupdate(fstream &toolsfile) {  int accounttomodify;  char nameoftool[ 30 ];  int numinstock;  double priceper;   printf( "enter record number ( 1 100, 0 return main menu )" );  scanf( "%d", &accounttomodify );   if ( accounttomodify > 0 && accounttomodify <= 100 )  {       printf( "enter tool name, quantity, cost" );       scanf( "%29s %d %d", nameoftool, numinstock, priceper );        data tooltowrite = { accounttomodify, nameoftool[ 30 ], numinstock, priceper };        toolsfile.seekg((accounttomodify - 1) * sizeof(toolsfile));       toolsfile.write((char *)&tooltowrite, sizeof(toolsfile));  }  else  {       printf( "invalid record number provided." );  }   printf( "\n\n" ); } 

specifically, line:

data tooltowrite = { accounttomodify, nameoftool[ 30 ], numinstock, priceper }; 

getting error:

[warning] converting `char' `double'  

but doesn't make sense me; "data" should int, string of characters, int, double, , scanf line should capturing string of characters, int, , double, , line assemble tooltowrite should expecting , integer, string of characters, integer, , double... don't understand thinks i'm converting double char if specified %29s in scanf line; %s fails well.

i feel i'm missing extremely basic , driving me nuts. ideas?

how changing line:

data tooltowrite = { accounttomodify, nameoftool[ 30 ], numinstock, priceper }; 

to

data tooltowrite = { accounttomodify, *nameoftool, numinstock, priceper };