mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-28 10:52:33 +00:00
07172d7359
CC:comment,scopes fixes DAN2ETH:fixes for IIgs
33 lines
688 B
Plaintext
33 lines
688 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[%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
|