Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Reading "csv" data from Clipboard question

Posted on 2002-05-24
1
Medium Priority
?
313 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 528 total points
ID: 7031901
Hi!
did you try
CString aDecSym = GetLocalInfo(...,LOCALE_SLIST);//??
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

715 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