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
 get path of an ascii 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 - 07/09/2009 :  09:32:38 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Iris_Bai

China
Posts

Posted - 07/10/2009 :  03:29:52 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

christo2

Germany
Posts

Posted - 07/10/2009 :  05:25:56 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi iris,

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

best regards,
conny
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