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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 AscImpReadFileStruct problem

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
newuser_ca Posted - 09/04/2012 : 2:28:08 PM
OriginPro 8.6 in Win7

I am importing a csv file using AscImpReadFileStruct. I noticed that if I have a small set of data, function AscImpReadFileStruct is not working well.
I use the following codes to import.

int errCode = AscImpReadFileStruct(fileName, &ai);

The csv file is :
"Value","Word","Mnemonic","ID","Timestamp"
0.06941799819469452,W20630,"S2_Batt_Recharge_Ratio",F2,2456175.1316697453
0.07112599909305573,W20630,"S2_Batt_Recharge_Ratio",F2,2456175.1320490045
0.07277300208806992,W20630,"S2_Batt_Recharge_Ratio",F2,2456175.1322386344
0.07448100298643112,W20630,"S2_Batt_Recharge_Ratio",F2,2456175.132617882
0.07618899643421173,W20630,"S2_Batt_Recharge_Ratio",F2,2456175.132997141


The first line is the column information and the rest is the data.
If I have 5 lines of data, function AscImpReadFileStruct is working well.
However, if I have only 4 lines of data, I get error Code 3002.

How can I import the file properly?

Thanks.
2   L A T E S T    R E P L I E S    (Newest First)
newuser_ca Posted - 09/05/2012 : 3:57:24 PM
Hi Penn,

Thanks a lot.
Penn Posted - 09/05/2012 : 01:28:06 AM
Hi,

It seems a bug in Origin 8.6. I have tried in the in-house build of next version (9.0), it works fine. For now, you can try the impcsv X-Function, such as

string strfile = GetOpenBox("*.csv");  // select the file
if(strfile.IsEmpty())
	return;

string strCMD = "impCSV fname:=\"" + strfile + "\" options.HeaderLines.SubHeaderLines:=1 options.HeaderLines.LongNames:=1";  // construct the LabTalk command
Worksheet wks;
wks.Create();
LT_execute(strCMD);  // execute the LabTalk command


Penn

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000