July 23rd, 2010, 07:29 PM
Is there a way in a linux environment to list all files in a specific directory? I wonder if it's possible in C and not C++ or C# since I studying for a course.
Could someone explain what this macro do?
#define DATA_REG (*(unsigned char *) 0x200 )
July 23rd, 2010, 08:01 PM
You can use the combination of opendir() and then readdir() to get the contents of a directory. Don't forget to use closedir() when you are done.
As for your other question, the inner cast is treating the 0x200 as an address, and then the outer '*' is dereferencing the address so that the value at the address can be read (and if permitted, written to). If for example, the address represents a 16-bit (2-word) register, you could use the macro as such:
unsigned short value = DATA_REG;
July 23rd, 2010, 09:21 PM
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.