Noob Question CString to Float conversion

Hey guys - I am having difficulty in converting a CString to a float value
to allow me to do calculations with it.

Any help would be appreciated.

Thanks.


0
indigoed (6)
11/23/2003 6:41:20 PM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
690 Views

Similar Articles

[PageSpeed] 35

try atof()

"Rik Irving" <indigoed@btinternet.com> wrote in message
news:bpqv0g$qv8$1@titan.btinternet.com...
> Hey guys - I am having difficulty in converting a CString to a float value
> to allow me to do calculations with it.
>
> Any help would be appreciated.
>
> Thanks.
>
>


0
noone1 (387)
11/23/2003 7:01:15 PM
Rik Irving wrote:
> Hey guys - I am having difficulty in converting a CString to a float value
> to allow me to do calculations with it.

CString sString( _T("1.5 1.00000005") );
float fFloat;
double fDouble;

// sscanf returns the number of fields converted, here there are 2
if ( _stscanf( sString, _T("%f %lf"), &fFloat, &fDouble ) == 2 )
{
   FloatsAreAllYours( fFloat, fDouble );
}
else
{
   ErrorIsAllYours();
}

Observe the value for fDouble. It'll not be exactly 1.00000005...

0
mac1 (347)
11/23/2003 7:42:21 PM
Reply:

Similar Artilces:

CString question...
Hello group, Is there an equivalent to strtoul() that we can use for CString objects? I want to convert a number represented as text in a CString object to an ULONG variable. Thanks in advance, Geo Geo, > Is there an equivalent to strtoul() that we can use for > CString objects? No, CString has no such functionality. > I want to convert a number represented as text in a > CString object to an ULONG variable. Use strtoul. Why you don't want to use strtoul ? -- Regards, Kobi Ben Tzvi "Geo" <ckarakiro@hotmail.com> wrote in message news:175101c3...

How to pass library function output going to console into CString variable ?
Hi, How to pass library function output going to console into CString variable ? I am usign a library function , which shows its output into a console...Now I am using this function in MFC Application and need someway to direct the output of this library function into a CString variable so that I may display it later in a AfxMessageBox... Kindly suggest Thanks, a.a.cpp On 11 May 2005 05:01:58 -0700, iceColdFire wrote: > Hi, > > How to pass library function output going to console into CString > variable ? > > I am usign a library function , which shows its output into...

email question #3
I realise that this isn't specifically outlook, but my useless ISP cannot answer my questions. My question is do ISP's sometimes check the email address when you try to receive pop mail? My pop settings have the correct account and password, but a different email address to the one the ISP has provided (it is my domain email address and I forward the email to my ISP email address). I was intermittently getting questioned about my account name and password, but when I changed the email address to the ISP one the problem went away. I have got around it by putting my real email a...

CComPtr question
Let's see my code first. CComPtr<ShowDialogLib::IShowDialog> pShowDialog = NULL; if (SUCCEEDED(pShowDialog.CoCreateInstance(CLSID_ShowDialog))) { pShowDialog->put_Caption(L"Hello World"); pShowDialog->ShowDialogOut(); } That is the scope for the CComPtr, I want to ask if I need to do any clear up work after using that ? (e.g. calling Release() or reset the pShowDialog to null) -- My C++ and C# ( Traditional Chinese ) Web Site : www.franzwong.com ...

Using wildcards in CString::Find()
Using wildcards in CString::Find() I’d like to use the wildcards(" * ", " ? " and other) in CString::Find(), but it does not work. Always it returns -1. Could you advice me ? I must do the complicated searching. Maybe there are other ways for the substring searching . Alur. You can use CAtlRegExp or GRETA http://research.microsoft.com/projects/greta/ -- Regards, Rodrigo Corral Gonz�lez [MVP] FAQ de microsoft.public.es.vc++ http://rcorral.mvps.org ...

Noob To VB
Ok im Reallllllllllyyyyy new to programming in general and in trying to get a search working that as 7 different criteria on a form, all criteria are selected via dropdown and are unbound. i want to open a multiple items form based on a query that i made and apply the 7 criteria and filter the form from there i would like the ability to print the search Via a report i have made. now thusfar i have this and it dose not work at all and i am really need help lol: Private Sub Command28_Click() DoCmd.OpenForm "Main Inventory Advanced Search" If IsNull([Forms]![Advanced Inv...

Inventory List Question
Maybe someone can help me. I have been trying to work on this for some time and I can't figure it out. I want to create an inventory list which tracks the number of items in inventory, items sold, and a total of items sold. For instance, I want my list to have the following headings (or something similar) as shown below in cells C2:E2. Inventory Quantity Sold Total Quantity Sold 6 In cells C3:E3 I would like to enter the starting inventory (say 6 chairs). Then everytime a chair sells I would like to be able to enter in cell D3 the number sold and have ...

Two part question
I know how to take an Email list in my Access database and to generate Emails from it. What I need now is a little more flexibility in that email, I need to use a voting button. Is that possible? ...

noob question
We are currently running sharepoint on a server2003 r2 machine. A recent addition of data took it over the 2gb limit so now we are unable to do anything with the site. Rather than battle with this problem it makes more sense to consider an additional server running SQL server to host it. Does this make sense? What would you recommend for the installation? At the moment it is a single server installation, running Exchange with approx 25 users Thanks in advance. If this is an inappropriate ng then doubtless someone will tell me Geoff ...

Question on forwarding...
Hi All, I have a client with Win2000 Server and exchange... As it is set up at the moment, all mail address's are forwarded to the CEO of the company. Now they also want all mail address's forwarded to the head of department but STILL to the CEO. In the forward field only one entry can be present. I thought that entering the head of department for each individual forwarding and the head of department forwarded to the CEO would be the answer, but the individuals e-mail go to the head of department but stops there and don't get forwarded to the CEO. CEO | Head of Department ...

BOM question
I have a situation where I am trying to give our customer service people quantities on a group of items. Currently we sell under item number 100 but we order this item under the component number C100 so the inventory numbers for item 100 are never correct, but the user may not know the component C100. I am looking for the simplest solution to get the quantity information to the user. It looks like BOM can do what I want, so I setup one BOM. I was wondering if I am going down the correct path or if anyone had any other ideas. If I end up using BOM, how then do I retreive the stock count inf...

Vlookup Easy Question
Can vlookup search for multiple values? example: =vlookup(b6:b25,c1:g100,3,false) This is what I need to happen, but it doesnt work. -- comotoman ------------------------------------------------------------------------ comotoman's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=27292 View this thread: http://www.excelforum.com/showthread.php?threadid=473435 Tried entering it as an array formula? (Press Ctrl+Shift+Enter). -- TheRobsterUK ------------------------------------------------------------------------ TheRobsterUK's Profile: http://www.excel...

Exchange scripting question
I created some scripting to process all the incoming emails on an inbox. It works fine. Since all the processings happen in the Folder_OnMessageCreated, the question is what really happens if one event is still processing the last arrived email(s), there are new emails coming. Will this fire a new event? How does Exchange scripting agent work on this? Since I'm calling a DLL to grab all emails in the inbox, do some DB updates and then move these emails to a different folder, I certainly do not want to have multiple events running at the same time on the same emails. Thanks....

Filter Question
Hello, I have a spreadsheet in which column F contains descriptions. I need to have on the screen all the rows for which column F contains the word "hospital." How do I do that? Many, many thanks from a clueless person. When doing something new, work only with a COPY of your file. Left-click on a cell in column F. then do Stat > Filter > Autofilter.......then leftclick on the arrow at the top of column F and choose "hospital" from that drop down list. To go back to normal, just do Data > Filter > AutoFilter once more.....it's a toggle. Note,...

Question about blocked email
I'm using Outlook 2003, and recently got an email back from the postmaster telling me that a certain message that I blocked could not be delivered. I'm confused, when I block a message, is there an email going to that sender telling them/him/her that I blocked it? I hope not...........Peter PeterM <pmaston@comcast.net> wrote: > I'm using Outlook 2003, and recently got an email back from the > postmaster telling me that a certain message that I blocked could not > be delivered. I'm confused, when I block a message, is there an email > going to that sende...

Question about exchange in sbs
Hello, I am new to small business server. Downloaded it and installed trial today. Can I use exchange only for offline personal folders, shared contacts and calendars, etc. but still use my web host company email accounts? I have no desire to bring web hosting or email servers on site but I still want the full features of Outlook and exchange when people are at work. Thanks, "Splunk" <george@waypointsigns.com> wrote in message news:3377533d-cbd1-4be4-ba78-d5809f5fc6d6@13g2000prl.googlegroups.com... > Hello, > I am new to small business server. Downloaded i...

Two Questions
I am using W98 and Excel 2K 9.0 Question 1. On my sheet I print the column letters and row numbers. I have cells that contain comments such as 'Total of Rows 5 To 8' or 'Row 15 Less Row 23'. The numeric portion of these comments, 5, 8, 15 and 23, represent actual row numbers. If I insert or delete a row it now makes the comments wrong and they must be changed. Is there a way to structure these comments so the numeric portion is a variable that will change as rows are inserted or deleted? Question 2. I have a column, say column C, where rows 5 to 10 contain numeric data. Row 1...

NDR Report question
One of our users sent an email to one of our remote sites which has e-mail service through their local provider. The user addressed the email via the Custom Recipient Entry in our GAL. This is the NDR I got: 554 forwarding loop, mail is looping Does anyone have any idea what that means? I have searched technet and other sources and can not find anything on this error. Thanks Bob Schmidt it means that the mail is going in loop literally. Have you recently moved connectors or the IMC? if so then force replication on the directory, this will allow the MTA to discover ...

question
I am trying to create a formula so that from a list of say 2000 of which 1999 are "NO" and one will be a digit, what formula can I use so that this one is selected out of all of them? Example: 7 No No No No .... I want to create a formula so that all the cells are checked and it picks the 7 because it is not a "NO". Thanks. Might try an Excel newsgroup... Or Access -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com http://officebeta.iponet.net/en-us/publisher/FX100649111033.aspx "A.S." <AS@discussion...

M07 Budget Question
Does M07 still use annual percentages to calculate spending and income for each month, or have they changed it so that it shows true income and expense for the month in question? ...

Tricky question about rows of cells.
At the start of the day, our company has 0 transactions. Whenever a transaction occurs, we will save that transaction data in a single row of cells. Therefore, once 5 transactions have been completed, my spreadsheet will consists of 5 rows of distinct data. At the end of any given day, we will have completed N transactions which means that the spreadsheet will contain N rows of distinct transaction data. My question is: What is a good way to calculate or determine HOW MANY rows of data have been filled with transaction data?? (In other words, I'm trying to calculate "...

Summing Question
I have a question: If I have two columns such as: 9.5 2 3.6 3 14 1 22 1 8 2 9 3 7 1 How would I sum all of the numbers in column A that correspond with a 1 in column B? Of course I want to the same for 2, and 3 also. Thanks. On Jan 24, 5:34 pm, Jimmy <nos...@nospam.com> wrote: > If I have two columns such as: > 9.5 2 > 3.6 3 > 14 1 > 22 1 > 8 2 > 9 3 > 7 1 > How would I sum all of the numbers in column A that correspond with a > 1 in column B? =SUMIF(B1:B7, "=1", A1:A7) Assumi...

My 3 questions
Hi, all I have 3 three questions, could anybody give me a help, thanks a lot! 1) How to change the color of the pen in MFC? 2) How to make a application frame window start up at maximized size and user can not resize the window and move the window to other position? 3) How to hide the frame window title bar when application start up? -ja "ja" <josndrsn@yahoo.com> wrote in message news:%23O7cfWQ7GHA.940@TK2MSFTNGP03.phx.gbl... > Hi, all > I have 3 three questions, could anybody give me a help, thanks a lot! > 1) How to change the color of t...

Automates Access cells for a noob
So it takes me days to perfect the Excel Spreadsheet that my boss wanted, but now he wants too much and Excel can only go so far. I know nothing about Access so I'm looking for some pretty intense help. for example. If I type under a location "Dallas, TX" I want the next cell to automatically say "1" under its Region Column. Same as customers. Say if I enter "DynaTen" under a customer column, how do I make the names and email addresses automatically pop up for the cooinciding company? On Fri, 5 Oct 2007 11:56:03 -0700, HoganD87 <HoganD87@discussion...

Advanced Email tracking questions
Hi, i have some questions regarding email tracking with CRM 3.0 Example, a company sends out an email to a 1000 contacts in CRM. The email sent has 3 hyperlinks in it. One hyperlink to our general website, one hyperlink to a news item, one hyperlink (banner) to an advertisement of some sort. I know that CRM sets a label to every user who recieves this email via CRM 3.0, but i would like to know Is it possible to track which recipent click on what link(s) (on what time, to complete the list:) )? If so, how can this be done? what software/hardware/web application would be required to m...