mirror of
https://github.com/A2osX/A2osX.git
synced 2024-12-03 12:52:47 +00:00
33 lines
675 B
Plaintext
33 lines
675 B
Plaintext
|
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[%I]=%s\r\n", i, argv[i]);
|
|||
|
|
|||
|
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
|