1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
   |  
bool CChargementBoiteAntenneEtAntenneDlg::loadBA(CString strFileBA)
{
	bool b_result = true;
 
	char * format = strFileBA.GetBuffer(9);
	char seps[]   = ";";
	char *token;
 
	/* Establish string and get the first token: */
	token = strtok( format, seps );
	while( token != NULL )
	{
		 /* While there are tokens in "string" */
		 printf( " %s\n", token );
		 /* Get next token: */
		 token = strtok( NULL, seps );
	}
 
	double freq,imped1,adapt1;
	double imped2,adapt2;
 
	CString temp;
 
	CWinApp * theApp = AfxGetApp();
	if(theApp)
	{
  		temp = theApp->GetProfileString("CSV_DELIMITERS","DELIM",";");
		seps[9] = temp.GetAt(0);
	}
 
	m_list_carac_boite_antenne.DeleteAllItems();
 
	CStdioFile file;
	if(!file.Open((LPCTSTR)strFileBA,CFile::modeRead))
	{
		AfxMessageBox("impossible d'ouvrir le fichier "+strFileBA);
		return false;
	}
	while (file.ReadString(strFileBA))
	{ 
		if (sscanf(format,seps,&freq,&imped1,&adapt1,&imped2,&adapt2))
		{
 
		temp.Format("%1.lf",freq);
		m_list_carac_boite_antenne.InsertItem(m_list_carac_boite_antenne.GetItemCount(),temp);
		temp.Format("%1.4lf",imped1);
		m_list_carac_boite_antenne.SetItemText(m_list_carac_boite_antenne.GetItemCount() - 1,1,temp);
		temp.Format("%1.3lf",adapt1);
		m_list_carac_boite_antenne.SetItemText(m_list_carac_boite_antenne.GetItemCount() - 1,2,temp);
		temp.Format("%1.4lf",imped2);
		m_list_carac_boite_antenne.SetItemText(m_list_carac_boite_antenne.GetItemCount() - 1,3,temp);
		temp.Format("%1.3lf",adapt2);
		m_list_carac_boite_antenne.SetItemText(m_list_carac_boite_antenne.GetItemCount() - 1,4,temp);
		}
	}
	return b_result;
} | 
Partager