A2osX/ROOT/ctest/testloop.c.txt

33 lines
688 B
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
AUTO 3,1
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void *pBuf = malloc(256);
int main(int argc, char *argv[]) {
for (int i=0; i<=argc; i++) printf("argv[%D]=%s\r\n", i, argv[i]);
getchar();
strcpy(pBuf, argv[0]);
strcat(pBuf, ".c");
printf("Filename=%s\r\n", pBuf);
short int hFile = fopen(pBuf, O_RDONLY, 0, 0);
printf("hFile=%d\r\n", hFile);
int linecnt=0;
while (NULL == fgets(hFile, pBuf, 255)) {
linecnt++;
printf("%5D:%s\r\n", linecnt, pBuf);
}
fclose(hFile);
getchar();
free(pBuf);
puts("All done.");
}
MAN
TEXT root/ctest/testloop.c