DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2006
    Posts
    1

    How to open a file with the memory address instead the filename (path)

    I can’t reach a solution to the next problem:

    I have a C program that open a file with the function fopen

    fp= fopen( ‘ filename ‘, ‘r’); In a computer “filename” could be
    c://doc/text.txt.

    However I am trying to run the same C program in a PC Board (FPGA) with a
    PowerPC microproccesador, which is capable of run C programs, and the file
    that I want to open is in a DDR memory and begins for example in the memory
    address 0x10000000.

    How could I fill the pointer fp FILE *fp
    In order to the program works as in a computer.

    thank you very much

  2. #2
    Join Date
    Nov 2003
    Posts
    4,118
    Teh short answer is that you can't use FILE* to access a memory based buffer. Instead, use direct memory access: char * p = (char *) 0x10000000;

    And then read the data from the pointer. In some platforms you can map a file to the system's RAM. In this case, you use FILE * etc., but you need to use a few explicit system calls that open the physical file and map its content to a memory address.
    Danny Kalev

Similar Threads

  1. Replies: 1
    Last Post: 01-15-2003, 11:23 PM
  2. Path of the file sent for print
    By Sudeep in forum VB Classic
    Replies: 0
    Last Post: 12-07-2001, 03:48 AM
  3. Test a file to see if it's open
    By JohnN in forum VB Classic
    Replies: 12
    Last Post: 05-08-2001, 04:25 PM
  4. Replies: 3
    Last Post: 08-04-2000, 06:07 AM
  5. How to open a file in a network path
    By rbx99 in forum VB Classic
    Replies: 2
    Last Post: 04-28-2000, 10:25 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links