/* fild_1up.c */ /* Take a Control by the Number of Field. */ /* Modified Recyclable Object << 'firstwd()'. */ /* As I saw below, by using * isspace OR *from==' ', I can recognize field delimiter Blank (' '); * while by using * !isspace (NOT is space), I can capture the words at given field; * And tandem numbers of WHILE-loops becomes the field Number. * Now, here comes the first prototype of Field Number Controlled * given word Capture Recycable Object. * * I tested this for Win3.1 "DIR.Txt" by 'Pro134E.prj', and works fine. */ /* I wanted to make this one to be a geneic Based-on Field Number, Read and * Write control. Then it may be useful at various situations. * By a quick test, this did exactly what I wanted. */ /* Now, at any given field, I can skip or make it blank. * while () ++from; -> skip the field as if not exist. * while () *to++ = *from++ = ' ' -> make it erased (by white liquid paper). */ /* By this "Field_No2.c" version, suppose No Details of output control * is necessary, but just Field Number level control. * Column position Counter "i" is deleted. * -> Yes, this is working. When I applied to Win3.1 "DIR.txt" * It printed Field Shift in a few sporadic rows, since some of * them don't have the 2nd Field "Extention" Word. */ /* This way is out of 'main.c', but rather Recycling Object Control. * The 'main.c' can't control anything about. I already have * the 'Main.c' Control version by Column Position, so this would * be the best complement to it. Recycling Object like this is * so tiny, and go anywhere, and so easy to read and modify. Thus, * in this point of view, also the best complement to 'Main.c' * control. So, use this conveniently. */ /* This was originally, Liquid Paper on 4th Field. Now, with * 'upField', 'downField' variables, Liquid Paper is moved into * 'main.c'. Therefore, at here, I just need to, * UpField control OR * DownField control * This one is for 'UpField' from 1st to 2nd. * Again here, I have Options for I do choose for mute-mode on 4th to end, * OR, do something else such 'break' to get out of While-loop. * Let me see. */ /* Actually this "fild_1up.c" doesn't have anything to do. Because, * The 1st field is Actually Liquid Paper, then downField is * going to fill the rest. But let me try in parallel as much. * This is very stupid codes, since it's all mute-mode. However, * it is good to see in parallel to the other options, so I * will test it if works. */ #include <ctype.h> extern char *fild_1up (char *to, char *from) { /* 1st: Capturing 1st Field(Word) */ /* Now, here is the mode-switch place to mute. */ while (isspace(*from) && *from!='\0') { ++from; } while ( !isspace(*from) && *from!='\0' && *from!='.' ) { ++from; } /* Then, to the end of line, all mute-mode. */ while ( *from!='\0' ) { ++from; } // *to = '\0'; return (from); }