Pointer to memory

This is a discussion on Pointer to memory within the C Programming forums, part of the General Programming Boards category; I have an area of ram that holds data i.e. from 0x80000000 to 0x90000000. I am trying to point to ...

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    8

    Pointer to memory

    I have an area of ram that holds data i.e. from 0x80000000 to 0x90000000. I am trying to point to the address 0x80000000 and access the data stored there and the subsequent addresses. A register holds the start address of this area of memory.

    I tried the following but cannot access tha data stored at the address 0x80000000.

    unsigned int Reg;
    unsigned int *pAddr;
    unsigned int Var;

    Reg = 0x80000000;
    pAddr = (unsigned int*)Reg;

    Var = *pAddr;

    Any ideas?

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    I'll assume you are using an imbedded system or something to that effect here since as Salem said normally you can't just grab an address like that.

    You should be fine doing this:

    Code:
    unsigned int *pAddr = (unsigned int *)0x80000000 ;
    Also, assuming you do have access to this memory address I'd advise that you be careful. Usually a person asking this question is one who really shouldn't be trying to do this (you would already know what to do). It is possible that this an address contains information that is crucial to your OS. Furthermore, you can really screw up things if by tinkering with system information. It usually would require a reboot, but I've heard of cases where the OS has been corrupted.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 04-04-2009, 03:45 AM
  2. Replies: 5
    Last Post: 03-23-2009, 03:44 PM
  3. Replies: 2
    Last Post: 07-11-2008, 07:39 AM
  4. Question regarding Memory Leak
    By clegs in forum C++ Programming
    Replies: 29
    Last Post: 12-07-2007, 12:57 AM
  5. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 09:33 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21