123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|552|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> C/C++/C#/Other -> Directory List - File Attribute

Thu, 15 Nov 2007, 14:57
HoboBen
I've written this little directory file list in C so that I can stick it as ls.exe into /WINDOWS/system32/ and run "ls" in the command prompt instead of "dir". (Linux/Bash Terminal Habit)

I like it, and it works well, except that the Directory Attribute Flag always appears to be set.

This line:


Can anyone spot what I'm doing wrong?


Here's the full source (C language):
(If anyone wants, they can download the compiled EXE - I used Dev-C++ to compile it)



|edit| I also made a version which works in colour ls-colour but the source is a little messy. |edit|

-=-=-
blog | work | code | more code
Thu, 15 Nov 2007, 15:30
HoboBen
Oh, I think I got it!

The flags aren't being set back to off afterwards, so once they're on, they stay on! D'oh!

-=-=-
blog | work | code | more code
Thu, 15 Nov 2007, 15:39
Jayenkai
|edit| Yeah, that! |edit|
Thu, 15 Nov 2007, 15:48
HoboBen
Thanks for trying

I think I'm done with it now. Mission accomplished!

I might try and get filesizes done, but I was having trouble getting them read properly. I'll sleep on it

For those who may be interested:
v0.1.0.2 Colour ls Download
v0.1.0.2 plain ls Download

Screenie: |edit| Updated to Latest |edit|


Hope someone finds it useful. It's saving me a lot of frustration already

It also supports paths, e.g. ls ../../my/folder/another/folder/ will work fine.

-=-=-
blog | work | code | more code
Fri, 16 Nov 2007, 03:49
HoboBen
I've never got on well with C and strings

Thank you for your new code.

-=-=-
blog | work | code | more code
Fri, 16 Nov 2007, 05:04
HoboBen
Yeay! Got filesizes sorted. All I needed was a night's sleep.

Reckon I'm finished with it now.
v0.1.1.1 Colour

Might report weird sizes or something if you have a file bigger than 4GB. I don't have any that big, so I wouldn't know what happens for sure!

|edit| Oh now it also supports spaces in file names, e.g: |edit|


-=-=-
blog | work | code | more code