Ejemplo n.º 1
0
// ===========================================================================
// ASCII file import in format:   xxxxxxxxxx ?:???/?.?
	void receiver::OnImport()
// ===========================================================================
{
FILE *fp;
CString path,str;
char buf[300],fido[20];
int  zone,net,node,point,ret;
char *p;

	str.LoadString(IDS_TEXTFILT);
	CFileDialog dlg(TRUE,NULL,NULL,OFN_HIDEREADONLY,str);

	ret=dlg.DoModal();
	restore_base_path();
	if (ret!=IDOK)	return;
	BeginWaitCursor();
	path=dlg.GetPathName();
	fp=fopen(path,"rt");
	if (fp)
	{
		while (fgets(buf,199,fp))
		{
		   if (*buf==';')		   // comment
		      continue;

		   replace_tabs(buf);	   // remove TAB's
		   p=strchr(buf,':');
		   if (!p)
		      continue;
		   while (*p!=' ')
		         p--;
		   p++;
		   if (parse_address(p,&zone,&net,&node,&point)<3)
			  continue;

		   sscanf(p,"%s",fido);
		   *p=0;

		   m_edit_fido.SetWindowText(fido);
		   m_edit_name.SetWindowText(trim_all(buf));
		   OnAddMember();

		}
		fclose(fp);
	}
	else
		ERR_MSG2_RET("E_CANOPIM",path);

	EndWaitCursor();
}
Ejemplo n.º 2
0
/* replace tabs with blanks */
main(int argc, char *argv[])
{
    int len, tabstops = TABSTOPS;
    char line[MAXLINE], replaced_tabs[MAXLINE];

    if (argc == 2) {
        tabstops = atoi(argv[1]);
    }

    while ((len = getline(line, MAXLINE)) > 0)
    {
        replace_tabs(line, replaced_tabs, len, tabstops);
        printf("%s\n", replaced_tabs);
    }
    return 0;
}