i just want to shoot my both hands, eyes and legs.

NO I DID NOT MEAN __d_dirname!!!!
I MEANT dd_name!!
NOT d_name, but dd_name!!

i swear to god the other times it worked. WHAT THE FUCK IS WRONG? I SPENT 3 FUCKING HOURS DEBUGGING THIS SHIT!

yes i have included sys/types.h, dirent.h AND sys/stat.h AND I CAN'T DO THIS ANYMORE!!

why did you worked last time? i just wanted to implement a better library than handling all the known and unknown errors myself.

if anyone knows what is wrong, please help me, i am disperate.

  • 1
    Did you mean d_name
  • 0
    @electrineer no, that is for the dirent struct. I want the dd_name for the DIR struct.

    actaully what i want is this.

    when run the program it should accept an argument and that argument should be a path to a folder. and if you run
    . /evalite .
    it should output the name of the folder itself, in this case evalite.
    or if i run
    ./evalite ..
    it should output 'projects', the name of the folder. currently it outputs . and .. in those cases and I know the way to do this is accessing the variable dd_name because i used this in other projects of mine.
  • 1
    had this happen to me

    check for rogue brackets
  • 1
    @Parzi what do you mean by that? i never heard that term before.
  • 1
    @zetef check for brackets {[( out of place or missing
  • 1
    @endor @Parzi no guys, it just doesn't want to. and i swear to god i have functional programs that worked with this. anyways, do you know how should i do this problem? i just want to output the folder name of the folder path entered as a command line argument.




    >./program .


    >./program ..


    i searched all of the internet and no luck.
  • 1
    Try if it works if you strip everything else out of the file
  • 1
    Can you share some code which worked with this?

    Also check this https://stackoverflow.com/a/...
  • 2
    @electrineer https://github.com/zetef/Smedit
    an older side project of mine. i used the dd_name to set the title bar text to the current folder. forgive me for the ugly code formatting and literally everything, i was just begining open source coding.

    look at line 163 specifically. dir is a global DIR* structure.
  • 1
    @zetef does that project compile in your current environment
  • 0
    @electrineer yes. here is the build log if it helps:


    and my dirent.h in my include folder from mingw:

  • 1
    @zetef isn't that a different compiler?
  • 2
    @electrineer omg dude. I FUCKING LOVE YOU. (no homo) YOU JUST PUT A SMILE ON MY FACE. IT FINALLY WORKED. thanks dude for helping me and staying for this long . if you ever need me contact me no problem. THAAAANKS!! I CAN BARELY HOLD MY TEARS. THIS PROBLEM WASTED HOURSSS OF MY LIFE. THANK YOUU!
  • 0
    @zetef this is probably why it says on the link I posted earlier: "You shouldn't be accessing the contents of a DIR directly."
  • 0
    @electrineer after a little more digging and using -v when compiling i found out it was using cygwin version, not the mingw version. i just hope my project will compile on a linux system because i currently do not have access to one yet. (i have to wait til september)
  • 0
    @zetef can't you run a vm?
  • 0
    @electrineer my machine has 2gb of ram and a pentium running, so nooo.
    it's just a laptop from the early '10
  • 2
    @zetef install linux on a thumb drive then
  • 2
    Well yeah, non-portable hacks can break at any moment. That's what happens when you access stuff directly that doesn't even have specified content.

    And a live Linux distro is easy enough to boot up from USB or DVD.
Add Comment