| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| C++ (Non Visual C++ Issues) Ask or answer C and C++ questions not related to Visual C++. This includes Console programming, Linux programming, or general ANSI C++. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Help needed with conversion to string
Hi everyone,
I dint not post the complete program, just the most relevant parts. I think the problem is with conversion part towards the end . I cant print the correct values to the text or edit box on the GUI, it prints out some weird values. Thanks in advance for the help. The value "ADD" is like "5.641087567e-007". CODE: chemicalname = (Edit3->Text); if (chemicalname == "7440-38-2") { ChemRfDwater = 0.0003; this->Edit8->Text = FloatToStr(ChemRfDwater); } else if (chemicalname == "7440-43-9") { ChemRfDwater = 0.0005; this->Edit8->Text = FloatToStr(ChemRfDwater); } else if (chemicalname == "7440-02-0") { ChemRfDwater = 0.02; this->Edit8->Text = FloatToStr(ChemRfDwater); } else if (chemicalname == "7783-79-1") { ChemRfDwater = 0.005; this->Edit8->Text = FloatToStr(ChemRfDwater); } else if (chemicalname == "7440-66-6") { ChemRfDwater = 0.3; this->Edit8->Text = FloatToStr(ChemRfDwater); } FILE *SourceFile = fopen ("c:\\temp\\test.grf","r"); if (SourceFile != NULL) { while(fgets(sizeLineInput, 10000, SourceFile)!=NULL) { token = strstr(sizeLineInput ,"IngWater_HumRcp"); if (token) { fgets(sizeLineInput, 10000, SourceFile); while((c=fgetc(SourceFile))!='\r') { if(c==',') { num[idx]=0; n++; array[n] = atof(num); idx=0; } else { num[idx] = c; idx++; } break; } } } for (int i=1;i<n+1;i++) { if (array[i]>largest) { largest=array[i]; } } ADD = largest; HazardQuotient = (ADD/ChemRfDwater); if (token == NULL) { Application->MessageBox("Refer to the messages for details.\n It could be one of the several reasons, namely:\n 1. Mass does not reach water-table. \n 2. Mass does not reach well. \n 3. Well is not in the direction of the aquifer.", "Message", MB_OK + MB_DEFBUTTON1); } } |
|
#2
|
||||
|
||||
|
Re: Help needed with conversion to string
Please use code tags to format your code. Also, do you have a complete program? What is 'chemicalname'? What is 'ChemRfDwater'?
Viggy |
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|