Linux directory question

This is a discussion on Linux directory question within the C Programming forums, part of the General Programming Boards category; Heya, I've been toying about with SDL lately, and in my self-testing, I've written a program for displaying an image ...

  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    17

    Linux directory question

    Heya, I've been toying about with SDL lately, and in my self-testing, I've written a program for displaying an image file in a window. So far, I've made a version that keeps the image file in the same directory as the executable as well as one that seeks it in another directory, but my big question is simply this: How can I have it search a directory contained within the current user's folder? The actual directory I'm trying to search would be /Home/username/.directory/file and I have little to no idea how to get this to work, or really if it is even possible. I hope someone can answer this... @_@;

  2. #2
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,309
    Look at getenv() to get the HOME environment variable.

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    2,560
    You may be able to use the getenv() function to get the "HOME" directory and then search from there.

    Jim

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Directory Traversal Question. lstat error.
    By TheTaoOfBill in forum C Programming
    Replies: 1
    Last Post: 11-13-2010, 08:57 PM
  2. Wireless Network Linux & C Testbed
    By james457 in forum Networking/Device Communication
    Replies: 3
    Last Post: 06-11-2009, 11:03 AM
  3. A Question about Locks in Linux Threads
    By Overworked_PhD in forum Linux Programming
    Replies: 2
    Last Post: 11-05-2007, 02:20 AM
  4. Question about Linux Firewall
    By naruto in forum Linux Programming
    Replies: 6
    Last Post: 07-25-2004, 12:39 PM
  5. Question about LINUX
    By River21 in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 09-17-2001, 06:39 PM

Tags for this Thread


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