Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7406135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:30:36+00:00 2026-05-29T05:30:36+00:00

I want to fix an old C program (got the source) that uses relative

  • 0

I want to fix an old C program (got the source) that uses relative paths to load data files, expecting the executable is called from the directory where it is placed, such as LoadEx("./dataFile", dataFile); Of course calling the program from another directory fails since the dataFile cannot be loaded.

How can I modify the C program to load dataFiles relative to the executable’s directory?

EDIT:
My original question turned inapplicable and so is a duplicate to at least:
– How do I find the location of the executable in C?
– How to open a file with it's relative path in Linux?
– Finding current executable's path without /proc/self/exe

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T05:30:38+00:00Added an answer on May 29, 2026 at 5:30 am

    Why don’t you want readlink("/proc/self/exe")? This is the way one finds the executable’s path on linux.

    The only other way is pull the PATH from the environment with getenv() and walk the PATH directories looking for a match for argv[0]. The first option is much easier.

    Or write a script to initiate the program after first doing a which on the executable and passing the result in as a command line argument or some such hack.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do I fix that error once and for all? I just want to
We've got a reasonable sized C++ application that's pretty old at this stage, so
I want to fix a file in past commit. This might affect all ascending
I want to fix the Background while only the ListFields scrolls. Current Problem: Scrolling
i have a double, the decimal place isn't fix (8-?) i want to fix
I want test a FIX gateway for our company and was wondering if anything
Ok I want some opinions how I can fix this mess of a method!
I noticed that fckeditor tries to fix bad html syntax. I was wondering if
I've got some old command-line argument parsing code I wrote 4 years ago for
I want to compile an old (1998) implementation of Edge Collapse from Game Developer's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.