Mail Archives: djgpp/2002/10/08/08:15:15
On 08 Oct 2002 13:40:29 +0200, David Kastrup
<David DOT Kastrup AT t-online DOT de> wrote:
>dmcg6174 AT yahoo DOT com (daniel gerard mcgrath) writes:
>
>> On 8 Oct 2002 08:48:20 GMT, Hans-Bernhard Broeker
>> <broeker AT physik DOT rwth-aachen DOT de> wrote:
>>
>> >In comp.os.msdos.djgpp daniel gerard mcgrath <dmcg6174 AT yahoo DOT com> wrote:
>> >> Hi. I use the DJGPP version of Emacs under DOS (Windows 98). I am
>> >> trying to figure out, how do you get a sort of "M-x shell" command,
>> >> where you type in successive DOS commands?
>> >
>> >M-x shell and similar commands, i.e. anything where you type live
>> >command input to some other program into an emacs window, cannot work
>> >on DOS. DOS *is* a single-tasking operating system, after all.
>>
>> Hmmm, I guess maybe I should then get my C source code translated into
>> Emacs-Lisp? Here it is:
>>
>> int main(int argc, char **argv)
>> {
>> int i;
>>
>> for (i = 1; i < argc; ++i)
>> {
>> int c, lines;
>> FILE *file;
>>
>> lines = 0;
>> file = fopen(argv[i], "r");
>> while ((c = getc(file)) != EOF)
>> {
>> if (c == '\n') { ++lines; }
>> }
>> printf("%d\n", lines);
>> fclose(file);
>> }
>> return 0;
>> }
>>
>> /*** end of clif.c ******************************/
>>
>> Maybe I can get somewhere from there?
>
>C-h f count-lines
>
OK! Well, actually, I need a function that works something like this:
(count-lines-in-file FILENAME)
where FILENAME is some sort of path name, like
"/windows/dansstuf.txt", and the result being that the number of lines
(i.e. newline characters) in DANSSTUF.TXT (or whatever) is returned
from the "count-lines-in-file" function.
--------------------------------------------------
daniel g. mcgrath (currently going through a depression)
http://members.tripod.com/denyore_w0o/
- Raw text -