Thursday, June 1, 2023

Functions, new programming language, Text read 2.0



Width books is pretty easy to advance in your work. One of the books is 3º edition and the other 4º edition revised. the code is all tested...

Count chars from a file
[code]
int count_chars (FILE *f)
{
int r = 0;
while(fget(f) != EOF ){
r++;
}
return r;
}
[/code]

Count chars and lines from a file

[code]
int count_chars_lines (FILE *f, int *nl, int *rc )
{
int rc = 0;
int rl = 0;
while((get(f)) != EOF ){

if (c== '\n'){
rc++;
}

}
*nl = rl;
*nc = rc;
}
[/code]

was debating a bit on global's. but what it seems is that global's in C are the pointers, you can access any thing in a structure form. In 2º function he return the values width pointers and not return.

For the new programming language or at least rules to read text made some updates compared width the before raw style:
[code]

----STR file-----

/t title
/ta tags
/d description
/c code

</1 start line + line number  t/ (b,i,ul) title or tiles ta/ 'tags' tag1, tag2, tag3 ... ;
[/code]

mixing database rules , width html tags and programming format ';' like end of line, so that the text files do a lot before programming.

[u]
What we can do width this: [/u]

[list]
- is not need but we can first define tags
- First tag and number.  we can index things in a db format to speed the use of the file, also to allow comments and other stuff not programming. Will not be confusing adding numbers to line? no because if you start the file the program does that auto
- The t/ tags allow to have pre format things for the programming to process
- The character ';' The end line. determine the lines to prevent excess processing. it have no closing tag  like html. it adopted programming style. it have a general line close. also to prevent excess text.
- /T (b,i,ul)  style in tag makes pre interface elements. like say that the title will come in bold italic in a unordered list. This prevent to re compile the code just for the style which is a lot of work.
[/list]

Call it STR standard Text reader

No comments:

Post a Comment

hi

Rules

Rules, Steps & methods This is the current way to implement and be implemented but there could be more things to add : Root or loader  (...