0

I try to convert QString to const *char, it generate General Protection fault. I could't understand about that.

dmesg

code that generate General Protection fault

When I checked with gdb, segment fault is generated in "vfprintf".

gdb result

  1. What does mean "General Protection"
  2. I tried to run this code other system, it works well. Are there any conditions that could cause problems?
    1. redhat 6 / qt 4.6
    2. redhat 7 / qt 4.8
  • I have already tried converting to "toStdString, toLocal8Bit, etc..."
Soheil Armin
  • 2,725
  • 1
  • 6
  • 18
ming
  • 1
  • Welcome to SO. Please take a moment to take our [tour](https://stackoverflow.com/tour) and learn [how to ask a good question](https://stackoverflow.com/help/how-to-ask). In particular, please avoid using pictures of code or error messages, and instead copy/paste the actual text into your post. – JarMan Feb 10 '22 at 14:27
  • "General Protection Fault" is the name Intel assigned to the exception that happens when you try to use an invalid address. Unix traditionally calls that a "segmentation fault". – Tim Roberts Feb 14 '22 at 19:47
  • Is that literally your code? It shouldn't fail, but if you tried the shortcut `qstrputresult_path.toUtf8().constData()`, that CAN cause the result you see, because that returns a pointer to a temporary object that gets immediately destroyed. – Tim Roberts Feb 14 '22 at 19:55

0 Answers0