I want to make simple C Program which show current directories and files like dir or ls .This should be use interrupt for getting current directory and its subdirectories and files.Help me to make this program. I Saw 21h interrupt with its service 47h and 4Eh .

Thanks

For starters: are you really programming for DOS? Plain old DOS. Not a Win32 console or anything, but 20-year-old DOS?

Sir i know i can these work with dos or win32 api efficiently but i have some limitation here to do with interrupt please guide me if know better solution thanks

win32 api functions: FindFirstFile() and FindNextFile() will do that for you -- you don't have to resort to interrups. Here is a c++ way of doing that. BTW C++ is NOT required to use those functions

If you are using ancient MS-DOS compiler such as Turbo C or TurboC++ then obviously you can't use the above code snippet or functions. But dos.h contains _dos_findfirst() and _dos_findnext() . Again you don't have to use assembly interrupts.

Sir i know very well this can do better but in my case i have to use interrupt if you have knowledge about interrupt please told me

Haroon Idrees
Sr. Software Engineer
Sun certified Java Programmer
Sun Certified Mobile application developer
IBM J2ee and Its Connectivity Developer
IBM XML and Related Tech Developer

This is not a C proglem then, but an assembly language problem. But you should know that you can not use those interrupts with any modern 32-bit C or C++ compiler or create a DLL that contains them, or interface with any java program.

BTW: The subject of this thread is wrong -- there is no such thing as a C interrupt.

For starters: are you really programming for DOS? Plain old DOS. Not a Win32 console or anything, but 20-year-old DOS?

why ? what's the problem ? DOS is a good starting point as well as win32 . The DOS and the Win32 is different flactforms that support different types of memory model and a programming framework to the Application programmer who programs on it . Think about the C/C++ the language syntax is same and not changed it comes to the win32 world only new shated helder files are added and there is a little big change in the memory model . However the language syntax is nothing is changed . Therefore I disagree your idea . You say that DOS is very OLD and don't do programming on it . That's not the point ,
assembly language can be on a ,
(1) . Small Smart card device
(2). On your cell phone
(3). On a big supercomputer or a mainframe system , ( I remembering the Quake 4 data processing terminal ) , he he !
(4) On the international space-station that will going to land on the ocen !
, wheter or whatever the language is a mathematical specification about the program logic ! It does not depend onhe underlaying hardware but it uses underlaying hardware . Dont worry haroonob , you just learn ASSEMBLY LANGUAGE ON DOS , I does not mind that . If you know it very well , after that stage , you will fell comfortable and really feels nothing to learn new in win32 instead of some win32 programming model , crazy APIS and memory model . These things can be learn very quick if you are a expert in assembly , I mean any assembly , it may be PIC microcontroller assembly. and don't be limited to a one CPU and a plactform , beacuse world is changing and you have to get it . The best thing you have to done is that if you are a stater , and you already choose DOS assembly go through it and be some smater , and then move the eye on others win32 , linux32 , ARM , PIC , .... FUN !
after that you can really find a way to master ! then choose your most interested path and run away ! ,
about my story is , I've use an illeagal version of Turbo Cv3.1 to lean C++ and C programming . However I'm writing win64 applications using the language C and C++ . That comes insider of you ! Don't worry and be paitient and learn and go ahead !

However Mr/Ms. Dave Sinkula , thank you about your interest about the win32 flactform , but the real story is win32 is very soon will be die , just win64 is exist , there are many advantages in win64 including security. So then according to your argrument , what did I say that what the point of learning win32 , its very old know !

sanzilla : freedom for asking and learn and experiment and talk !

Sir i know i can these work with dos or win32 api efficiently but i have some limitation here to do with interrupt please guide me if know better solution thanks

Did you know that protected operating systems don't let you deal with interrupts directly? Did you know that one of these is a protected API and the other isn't?

Sir i know very well this can do better but in my case i have to use interrupt if you have knowledge about interrupt please told me

Haroon Idrees
Sr. Software Engineer
Sun certified Java Programmer
Sun Certified Mobile application developer
IBM J2ee and Its Connectivity Developer
IBM XML and Related Tech Developer

With these feathers in your cap, I'll gather that you do.

why ? what's the problem ? DOS is a good starting point as well as win32 . The DOS and the Win32 is different flactforms that support different types of memory model and a programming framework to the Application programmer who programs on it . Think about the C/C++ the language syntax is same and not changed it comes to the win32 world only new shated helder files are added and there is a little big change in the memory model . However the language syntax is nothing is changed . Therefore I disagree your idea . You say that DOS is very OLD and don't do programming on it . That's not the point ,
assembly language can be on a ,
(1) . Small Smart card device
(2). On your cell phone
(3). On a big supercomputer or a mainframe system , ( I remembering the Quake 4 data processing terminal ) , he he !
(4) On the international space-station that will going to land on the ocen !
, wheter or whatever the language is a mathematical specification about the program logic ! It does not depend onhe underlaying hardware but it uses underlaying hardware . Dont worry haroonob , you just learn ASSEMBLY LANGUAGE ON DOS , I does not mind that . If you know it very well , after that stage , you will fell comfortable and really feels nothing to learn new in win32 instead of some win32 programming model , crazy APIS and memory model . These things can be learn very quick if you are a expert in assembly , I mean any assembly , it may be PIC microcontroller assembly. and don't be limited to a one CPU and a plactform , beacuse world is changing and you have to get it . The best thing you have to done is that if you are a stater , and you already choose DOS assembly go through it and be some smater , and then move the eye on others win32 , linux32 , ARM , PIC , .... FUN !
after that you can really find a way to master ! then choose your most interested path and run away ! ,
about my story is , I've use an illeagal version of Turbo Cv3.1 to lean C++ and C programming . However I'm writing win64 applications using the language C and C++ . That comes insider of you ! Don't worry and be paitient and learn and go ahead !

However Mr/Ms. Dave Sinkula , thank you about your interest about the win32 flactform , but the real story is win32 is very soon will be die , just win64 is exist , there are many advantages in win64 including security. So then according to your argrument , what did I say that what the point of learning win32 , its very old know !

sanzilla : freedom for asking and learn and experiment and talk !

Blah, blah, blah.

Realize I'm not talking about any C language, I am addressing the platform any such code is being attempted to be run on. If you are on DOS proper, you can use the interrupts. If not, say Windows, the simulation is not necessarily going to be the same.

So my question to the OP is this: do you want an answer? Or do you want something that doesn't work for you?

In short, I'm getting at this.

[edit]BTW, I don't need a lecture on embedded systems programming.

One more thing...

Dont worry haroonob , you just learn ASSEMBLY LANGUAGE ON DOS , I does not mind that .

Yes. Avoid advice of this silly Intel engineers:

Getting the Bubbles Out of Code: Designing for the ItaniumĀ® 2 Processor
Author: IntelĀ® Software Network
Published On: Wednesday, January 04, 2006 | Last Modified On: Wednesday, January 04, 2006

If the wrong combination is bundled, the processor cannot execute the instructions in parallel. Because of the complexity of bundling and sequencing instructions correctly, developers are discouraged from using assembly language on the Itanium platform. For most purposes, the most efficient code will in fact be generated by the compiler, as it has intimate knowledge of the proper instruction sequences. For similar reasons, assembly-level programming was discouraged on RISC platforms. However, the penalty for writing suboptimal assembly language on RISC chips was small by comparison to the effects Itanium architecture-based systems.

Surely you know much more about the underlying platform and can readily discard 2-year-old advice from the people who make the chips and the compilers.

Yesteryear's programming tomorrow!

I want to make simple C Program which show current directories and files like dir or ls .This should be use interrupt for getting current directory and its subdirectories and files.Help me to make this program. I Saw 21h interrupt with its service 47h and 4Eh .

Thanks

You completly sidestepped the question about what platform you are using and what you intend to do with it, such as interface with java. With your level of programming knowledge surely you can write your own assembly program that will do what you want.

If all you want to do is give us a lecture about why our suggestions are of no value to you then sorry, but we won't be of much help to you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.