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
 LabTalk Forum
 Save file with identical name - append version
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

peter.cook

UK
356 Posts

Posted - 05/28/2004 :  08:50:32 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
HI,

I want to save all graphs created within an origin application via LabTalk and C to a single folder. However, many will have identical default names.

One approach is to see if a file of that name exists and if so append eg v2, v3 to the file name. Okay, no problem.

I was wondering if it might be quicker to trap this as an error when saving then trying with eg v2,v3 appended to the file name. If so, how could this be done.



NB This would be over a network.

Cheers,

pete

Mike Buess

USA
3037 Posts

Posted - 05/28/2004 :  11:12:03 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Pete,

Not sure how about the best way to incorporate this into error handling or about the implications of network paths, but an easy way to deal with duplicate file names is with get_next_file_name().

Global Functions->File Management

bool get_next_file_name(string& strFilename, bool bCheckCreatePath = true)

Example:

string str = GetAppPath() + "origin.ini";
get_next_file_name(str);
out_str(str);

>>C:\Origin75\User\origin1.ini

Mike Buess
Origin WebRing Member
Go to Top of Page

peter.cook

UK
356 Posts

Posted - 05/28/2004 :  12:17:12 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi MIke,

Nice (simple) idea - I'll look into it.

cheers,

Pete

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