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
 get path of an ascii import

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
christo2 Posted - 07/09/2009 : 09:32:38 AM
Origin Ver. 8.0 and Service Release 2
Operating System: WinXP

Hi.
I wrote an import routine, likes this:

ASCIMP ascimp;
string strFile = GetOpenBox("*.dat");
if(AscImpReadFileStruct(strFile,&ascimp)==0)
{
ascimp.iDelimited = 1;
ascimp.iDelimiter = ASCIMP_DELIM_SPACE;
ascimp.iMode = 1;
ascimp.nNumSep = NF_IS_AMERICAN;
ascimp.iAutoSubHeaderLines = 0;
ascimp.iSubHeaderLines = 0;
Worksheet impo;
impo.Create();
impo.ImportASCII(strFile, ascimp);
}

and it works well. Now I want to keep the path I got the ascii file from, so that I can later save the processed file/folder in that very path. Currently I use the following for saving:

Folder fld = Project.ActiveFolder();
bool bOK = fld.SaveAsProject(strFile, SFC_INCLUDE_SUBFOLDERS |
SFC_INCLUDE_ATTACHED_FILES);
out_int("bOK = ", bOK);

It works, but I want to save each file under a standard name (overwriting the old one).
Every hint is very much appreciated.

thank you,
conny

2   L A T E S T    R E P L I E S    (Newest First)
christo2 Posted - 07/10/2009 : 05:25:56 AM
Hi iris,

Thank you!
It worked like a charm. That one makes it really easy.

best regards,
conny
Iris_Bai Posted - 07/10/2009 : 03:29:52 AM
Hi conny,

Do you want to save opj to the same folder of ASCII file? If so, import ascii file to one worksheet, keep the worksheet active, and run the following codes:

#define MAX_SIZE	255
void Get_ASCII_Path()
{
	Worksheet wks = Project.ActiveLayer();
	if( wks )
	{
		WorksheetPage wksPage = wks.GetPage();
		
		char    szBuffer[MAX_SIZE];
		LT_get_str("page.info.system.import.FilePath$", szBuffer, MAX_SIZE);
		out_str("ASCII File: " + szBuffer);
		out_str("Path: " + GetFilePath(szBuffer));
	}
}


Iris

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