0

I do not understand why when modifying the name of the .cpp file, a file that opens without problems with the name "projec1.cpp", does not do so.

  1. No problem
    enter image description here

  2. No problem
    enter image description here

  3. The file does not open
    enter image description here

Any ideas?

Spektre
  • 49,595
  • 11
  • 110
  • 380
neg1414
  • 25
  • 5
  • not using firemonkey but my experience (with older C++ builders) is that 1. adding files to project is not the same as `#include` and the former often cause problems for custom C++ files its more suited for formulars packages and other linker related stuff 2. `*.cpp` files are compiled differently than `*.h` if they are added to project and sadly on newer RAD version even with `#include` the behavior is now much more like GCC/GC now. – Spektre Jul 24 '23 at 05:43
  • However I think its not your case and your problem is caused by [IDE/linker failing breakpoints](https://stackoverflow.com/a/65194422/2521214) its common for BCB for ages (usually for bigger projects) that some parts of code is ignored by debuger (no blue bullets at left) this sometimes remedy on some changes in code and recompile or by moving the `#pragma hrdstop` but not always however the code works as should just the breakpoints does not to verify output something on Canvas or TMemo TStatusbar or whatever ... – Spektre Jul 24 '23 at 05:46
  • Thanks for answering.. I forgot to clarify that this problem is under the android platform.. in windows it works perfectly. ... I have only put the breakpoints so that the explanation is clearer... without breakpoints the application has the same problem (it finds the file but does not open it)... I have worked for more than 10 years with c++ builder (windows platform) and it is the first time that I have this problem... I do not understand that the name of the .cpp file is decisive for opening a file. – neg1414 Jul 24 '23 at 09:34
  • The only thing I can think of ... does the paths/filename contain UNICODE specific characters ? (`fstream` might use non UNICODE functions) try to use [`FileOpen,FileRead,FileClose` functions](https://stackoverflow.com/a/49005275/2521214) instead of ancient fstream (not sure if present on Android targets with that names) – Spektre Jul 24 '23 at 14:05
  • @neg1414 "*I do not understand that the name of the .cpp file is decisive for opening a file*" - It is not, at all. The STL and the compiler don't care what you name your source files. That has no effect whatsoever on the runtime functionality. So, something else must be going on. Also, why are you using the `std::ios::out` flag on an **input-only** stream? `std::ifstream` is for input, `std::ofstream` is for output, and `std::fstream` can do both. – Remy Lebeau Jul 24 '23 at 19:53
  • I leave it, I give up, I can't, I don't understand it, I've done a thousand tests and either with `fstream` or `ifstream` if I don't save the project as "Project1.cpp" it doesn't open the file. The file I'm trying to read contains int data, can anyone suggest me how to read them one by one in another way? Thank you. – neg1414 Jul 25 '23 at 11:35

0 Answers0