The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Problem with Import
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

christo2

Germany
Posts

Posted - 08/06/2010 :  07:34:08 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. 8.0.63.988 Service Release SR6 (v8.0988)
Operating System: WinXp

Hi,

I came upon a problem with my importroutine, when i changed some phrasing in the file which I want to import (*.dat file). The phrasing is:

measurement resolution mode : NORMAL
measurement HIGH SENS mode : ON
DC SOURCE
DC Source AutoAdjust : OFF

I simply can't import it, when it is in this exact succession. I could change the succession, but I would like to know, what I did wrong. My standard import routine is:

string strfile, pfad;
StringArray saFilePaths;

StringArray saFileTypes;
saFileTypes.Add("[Messdaten (*.DAT)] *.dat");
saFileTypes.Add("[Messdaten (*.DTA)] *.dta");
saFileTypes.Add("[All Files (*.*)] *.*");

string strUserFilesFolder = "C:\measurement";

int nFileCount = GetMultiOpenBox(
saFilePaths,
saFileTypes,
strUserFilesFolder,
NULL,
"MultiOpen Dialog",
false);

if(saFilePaths[0].IsEmpty()) {return(false);}

for( int i = 0; i < nFileCount; i++ )
{
string strfile, pfad;
ASCIMP ascimp;

strfile = saFilePaths[i];
if(saFilePaths[i].IsEmpty()) { printf("Nothing has been chosen!"); return(false); }

if(AscImpReadFileStruct(saFilePaths[i],&ascimp)==0)
{
ascimp.iDelimited = 1;
ascimp.iDelimiter = ASCIMP_DELIM_SPACE;
ascimp.iMode = 1;
ascimp.nNumSep = NF_IS_AMERICAN;
ascimp.iAutoSubHeaderLines = 0;
ascimp.iSubHeaderLines = 0;
ascimp.iHeaderLines = 0;
ascimp.iTestLines = 75;
ascimp.iNumColumns = 75;

WorksheetPage impoPage;
Worksheet impo = impoPage.Layers(0);
impo.Create();
impo.ImportASCII(saFilePaths[i], ascimp);

string strBookName, strSheetName ;
string strBookSheetName = wks_get_book_sheet_name(impo);

if(get_book_sheet_names(strBookSheetName, strBookName, strSheetName)==TRUE) printf("imported File = %s\n", strSheetName);

impo.GetPage().Rename("Book"+i);
}
}

This routine usually does work. Just not with the lines I mentioned. If you could answer I'd be really happy!

Best regards,
conny

christo2

Germany
Posts

Posted - 08/06/2010 :  07:43:02 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
another thing I forgot to mention. That Problem (the file not being importable) also occures when I try to import it using the ImportWizard.

Best regards,
conny
Go to Top of Page

Penn

China
644 Posts

Posted - 08/08/2010 :  10:36:46 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi conny,

With just the code you provided, we can not see what the problem is. If possible, could you please send us your data file via this page? Then we can have a try with the code to import your data file. Please refer to this post in your email.

Penn
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000