Jump to content

BruceV

Members
  • Content Count

    6
  • Joined

  • Last visited

Everything posted by BruceV

  1. I would appreciate some advice on how to do the following. It seemed trivial, but I quickly got tangled up with the various formats for wide strings, a lot of the Embarcadero information turned out to be for Pascal, I’m working with C++ builder. And there are a number of different wide string formats. I am displaying double values on the canvas, the following obviously works fine: Label1 -> Caption = DoubleVal ; But I got into trouble when I wanted to constrain the display precision, there doesn’t appear to be a setting for the display object and just truncating the field width would be visually unappealing. So I applied the setprecision function with a stringstream output….. ostringstream oss ; oss << setprecision (4) << DoubleVal; // This works How do I go from the stringstream to the GUI? Or is there a more direct approach?
  2. Hello, I have recently installed and registered C++ builder CE, my first test program is not behaving correctly. It's a trivial C++ program, the file open fails. There is nothing that I can see that is incorrect, I've coded with files for decades. Any suggestions appreciated. #include <iostream> #include <fstream> #include <conio.h> #include <tchar.h> using namespace std ; ifstream ifs ; int _tmain(int argc, _TCHAR* argv[]) { ifs.open ("C:\\Junk\\testfile.txt") ; if (!ifs.good()) // ** Also tried if (!ifs) { cout << "Can't open input file.\n"; while (!kbhit()) ; return 1 ; } cout << "Opened OK\n" ; ifs.close() ; while (!kbhit()) ; return 0 ; }
  3. This is a mea culpa. I tested the suggested WIN32 alternative in a different project, and referenced a different .txt file. that worked. That raised suspicions, so I carefully inspected the .txt files I was trying to open. Somehow, the one that didn't work had had a second .txt appended, ie. it was testfile.txt.txt. The way that Windows displays file, that was not obvious, it was only when I checked the situation in a command window that the situation became clear. So my original code did work, when pointed at the correct filename. In hindsight, both responses to my post were of assistance, in generating enough doubt for me to relook at things. I also thought it important to exonerate the platform. Apologies for posting before investigating thoroughly.
  4. Thanks Remy for the extremely useful response. Your first suggestion threw up 40 (!) linker errors which are all way above my pay grade, and I wouldn't trouble you to go anywhere with them. The second one, the standard WIN32 approach, works fine and will do what I want. So thanks again! If I ever find out why my initial approach isn't working, I'll post the details.
  5. Hello, I have been using XE5 for many years, it has outlasted 3 machines. For the last two times I've simply reinstalled successfully, but this 3rd time I've come up against the install limit error, the registration failed. Is there a way that I can reset the active instance count given the situation, I accept that that request may be met with some scepticism. I can't think of any way to objectively demonstrate that there are no other instances in existence.
  6. Apologies in advance for this being probably OT. I am trying to register an installation of C++ builder XE-5 that I have just reinstalled following a machine failure. My credentials for these forums were many years old, and my email address has changed so I have just set up another account for this forum, it seemed the most appropriate. However, when I enter these new credentials into the XE5 license registration form it advises that they are not recognised. Having registered for this forum, are the credentials applicable for all Embarcadero forums? Forum credentials entry is required for product registration. The licence key I have is valid.
×