Solved

Reading "csv" data from Clipboard question

Posted on 2002-05-24
1
307 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Separate files macro - Errors on larger data set 18 77
lucky13 challenge 11 168
firstChar challenge 13 149
Detect file exist or not 3 215
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…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Suggested Courses

710 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