Solved

Reading "csv" data from Clipboard question

Posted on 2002-05-24
1
273 Views
Last Modified: 2013-11-20
Hi,
I'm trying to read data from excel to my application and I have some difficulties when the System decimal symbol is changed. My code look something like this:

/**************************************
UINT aFmt = ::RegisterClipboardFormat(_T("Csv"));
COleDataObject aClipboardData;
aClipboardData.AttachClipboard();
if (aClipboardData.IsDataAvailable(aFmt))
{
    CFile *pTableData = aClipboardData.GetFileData(aFmt);
    ...
}
/***************************************

when i'm copying from excel a 2x2 table with the values of:
1 2
3 4

then the content of my file will be:
1. if the decimal symbol is ".":
   1,2
   3,4
2. If the decimal symbol is ",":
   1;2
   3;4

I need to parse the file and I must know what is the value of the separator char ("," in case 1 and ";" in case 2)

Is there an API function that retrieve this separator value ???

BTW, currently I solve this in an ugly way by getting the decimal symbol (with GetLocaleInfo() method):

/*******************************
CString aDecSym = GetLocalInfo(...,LOCALE_SDECIMAL)
mSeperator = ( aDecSym == ',' ) ? ';' : ',';
/*******************************

Thanks,
Yoav
0
Comment
Question by:yoavo
1 Comment
 
LVL 12

Accepted Solution

by:
migel earned 132 total points
ID: 7031901
Hi!
did you try
CString aDecSym = GetLocalInfo(...,LOCALE_SLIST);//??
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now