473,383 Members | 1,818 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Segmentation fault on volatile unsigned char in C

2
here in code statement below 0xbfe2b935 is the address location, m tryin to put 1 on that. but it gives the segementation fault on that statement. wat will be the solution for this?? or any alternative??


*(volatile unsigned char *) (0xbfe2b935) = 1;

thanq
Sep 19 '07 #1
6 2841
gpraghuram
1,275 Expert 1GB
here in code statement below 0xbfe2b935 is the address location, m tryin to put 1 on that. but it gives the segementation fault on that statement. wat will be the solution for this?? or any alternative??


*(volatile unsigned char *) (0xbfe2b935) = 1;

thanq
This is what i guess about the issue.
If you get a segmentation fault it means the address is used by som other process and you are trying to access it.

Raghuram
Sep 19 '07 #2
elo
2
This is what i guess about the issue.
If you get a segmentation fault it means the address is used by som other process and you are trying to access it.

Raghuram

can u plzz suggest me any solution to overcome this??
Sep 20 '07 #3
gpraghuram
1,275 Expert 1GB
can u plzz suggest me any solution to overcome this??
I dont have any solution for this as of now.
Can Other members help him?

Raghuram
Sep 20 '07 #4
weaknessforcats
9,208 Expert Mod 8TB
0xbfe2b935
Where did you get this number from ??

This has disaster written all over it.
Sep 23 '07 #5
This address does probably not map to any allocated data segment.

Maybe you got it from a debugger and tried to patch your code, but the memory mapping is impacted by new instructions in the code.
Therefore you can try to get the new address you're looking by running new binary from a debugger.
Sep 23 '07 #6
arunmib
104 100+
A small clarification - why do you want to handle that address directly or what's your scenario for which you need to do this?
If you are programming an microcontroller "that might make sense, in some situation" but if it's in PC WHY?

Nothing offensive, just want to update my knowledge of these sort of occasions.
Sep 24 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

18
by: bumps | last post by:
Guys, I am getting segmentation fault while I am trying to open a file in a small function. int PingSamplesList::saveListElements (char *outputFileString) { PingSampleElement *tmpPtr; int...
13
by: N.S. du Toit | last post by:
Just having a bit of trouble programming with C under FreeBSD 5.1 using the gcc compiler. I'm a bit new to C so my apologies if the answer to my question appear obvious :) Basically I've...
15
by: Dennis Schulz | last post by:
hi y'all im a beginner in C language and i have problems running this programm. when i enter a newline there is a "segmentation fault". i dont know what it means and already spent too much time...
5
by: Fra-it | last post by:
Hi everybody, I'm trying to make the following code running properly, but I can't get rid of the "SEGMENTATION FAULT" error message when executing. Reading some messages posted earlier, I...
2
by: esanchezfo | last post by:
Please tell me what is wrong, what is the cause of the segmentation? #include <stdio.h> #include <malloc.h> void GetBuffer (unsigned char ** buffer) { * buffer = malloc (sizeof (unsigned...
10
by: Linny | last post by:
Hi All, I am pasting a piece of code which executes fine on 32 bit system but fails with a segmentation fault when compiled 64 bit compiler.I am using a HP-UX C compiler on PA-RISC system. This...
8
by: Andrea | last post by:
I wrote this code: void * xmalloc (size_t size){ register void *value = OPENSSL_malloc(size); if (value == 0) printf("virtual memory exhausted"); return value; } int _chooseTSK(char*...
8
by: asit | last post by:
plz fix the bug... #include <stdio.h> int main() { char ch; char i; printf("Enter an unsigned char : "); scanf("%d",&ch);
3
by: jr.freester | last post by:
I have created to classes Matrix and System. System is made up of type matrix. ---------------------------------------------------------------------------------- class Matrix { private: int...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.