Solved

Reading "csv" data from Clipboard question

Posted on 2002-05-24
1
286 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
not able to insert into temp table 68 157
Macro to save highlighted rows as a separate file 5 41
windows 10 how make picture as desktop background 2 58
Problem to event 3 79
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: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
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.

867 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

22 Experts available now in Live!

Get 1:1 Help Now