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
 ASCII Import - semicolon as delimiter

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
flexmann Posted - 07/15/2011 : 09:52:39 AM
Origin Ver. and Service Release: Origin Pro 8.0.63.988 SR6
Operating System: Windows XP Professionell 2002/ Windows 7 Enterprise

Hi.

I would like to write a C file to import a data file to do some further operations automatically.
For a data file with tabs as a delimiter, the following code works fine, but unfortunately, the relevant files have semicolons as delimiters. Therefore, the program doesn't import the data file.

What can I do make the program recognizing the semicolon as the delimiter?

By using the import wizard, I have already saved a filter, that can import the data file. Is it also possible, to implement this filter in the ASCII import in the code?


#include <stdio.h> 
#include <Origin.h>
#include <wksheet.h>
#include <Array.h>

int TPD()
{
	string file1 = GetOpenBox("*.csv");
	
	Worksheet wks1;
	wks1.Create();
	wks1.GetPage().Rename("H2O_date",FALSE,TRUE);
	
	
	ASCIMP	ai;
		if(AscImpReadFileStruct(file1, &ai)==0)
		{	ai.iAutoSubHeaderLines = 0;
			ai.iMode = ASCIMP_MODE_APPEND_COLS; 
			ai.iRenameCols = 0; column name
			ai.iPartial = 1; import 
			ai.iPartialC1 = 0; 
			ai.iPartialC2 = 5; 
			ai.iPartialR1 =40; 
			ai.iPartialR2 = 50; 
			int nRet =  wks1.ImportASCII(file1, ai);
			out_int("nRet = ", nRet);
		}
		return 0;
		
}


I hope you can help me.
Cheers, Felix
2   L A T E S T    R E P L I E S    (Newest First)
Penn Posted - 07/18/2011 : 06:13:31 AM
Hi,

This example will show you how to import a data file with semicolon as delimiter.

You can also import the data file by using a saved filter. See this page.

Penn
TreeNode Posted - 07/15/2011 : 11:25:18 AM
Hi flexmann,

I think setting the property like this:
ai.iDelimiter = ASCIMP_DELIM_SEMICOLON;

should work for you.
Sadly I didnt not find the whole list of defined delimiters.
In helpfiles only the values ASCIMP_DELIM_TAB, ASCIMP_DELIM_COMMA and ASCIMP_DELIM_OTHER are listed.
I am using the value ASCIMP_DELIM_SPACE for this property, to import my files.

http://ocwiki.originlab.com/index.php?title=OriginC:ASCIMP

hope this helps.



|-- TreeNode
...|-- a??
...|-- ha!!

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