[Segmentation Fault] Oops! The filename points to a constant string
来源:互联网 发布:zsy网络用语是什么意思 编辑:程序博客网 时间:2024/04/29 20:09
We can compile the following program using the gcc compiler.
But when running it, we get a segmentation fault.
Why ?
#include <stdio.h>int main(){ // The following statement is equal to " constant char* filename = "file1.txt"; "in c++ char* filename = "file1.txt"; // Initialization and after that filename points to a constant string. printf("\nPlease input for the filename ==> "); scanf("%s", filename); // Try to modify a constant string. It will cause a segmentation fault ! printf("\nThe file name you have input is %s", filename); return 0;}
- [Segmentation Fault] Oops! The filename points to a constant string
- a function to find the filename without extension
- Solution to ns2 dsr segmentation fault
- unable to execute command:Segmentation fault:11
- unable to execute command:Segmentation fault:11
- unable to execute command:Segmentation fault:11
- mmap3-map the ordinary file-segmentation fault
- The String Constant Pool
- Segmentation Fault
- Segmentation Fault
- Segmentation fault
- SEGMENTATION FAULT
- Segmentation fault
- segmentation fault
- segmentation fault
- segmentation fault
- segmentation fault
- segmentation fault
- android编译错误
- C语言经典示例七:带参数的宏
- 黑马程序员--Java基础之Java入门总结
- OMAP Pandroid Main
- 在ORACLE 10g里遇到“无效的月份”错误
- [Segmentation Fault] Oops! The filename points to a constant string
- 自定义列表对话框(二)
- Platform/Android
- 快速排序、冒泡排序
- C#多态
- Auto CAd ObjectARX vs vc++ 最佳组合
- Linux下安装软件命令详解
- pandaboard.org
- 黑马程序员_java入门_多线程