| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | (C_PLUSPLUS) portable diff for echomail? |
DM> 4. Can have a maximum number of lines per output file. See CSplit.
DM> 3. No line, whether context, addition or deletion, should exceed 75
DM> characters
FA> Let me contribute that routine straight away..
FA> int Three_Four()
FA> {
FA> return system("Csplit mydiff.dif ...");
FA> }
FA> ;-)
FA> I think 3 and 4 are an overkill, Csplit was made for
FA> exactly that purpose.
Well, we *can* assume that CSplit is available, but I wouldn't want to make
this into a two-step process. That means that requirements 3&4 are
basically, "Oh, and make sure CSplit is called behind the
covers." It would be nice to do this without the use of a temp file.
What this may mean is completely overtaking CSplit, writing it as a general
output stream handler such that we could basically putsToCSplit(), and it
would handle its own state information. CSplit's main() routine could
almost be written, then, something like:
int main(int argc, char** argv)
{
/* parse args */
CSPLIT* handle = CSplitOpen(outputfile, len_of_file, width_of_file);
FILE* input = fopen(inputfile, "r");
char buffer[512];
while (fgets(buffer, sizeof(buffer), input) != NULL)
{
CSplitPrintf(handle, "%s", line);
}
CSplitClose(handle);
fclose(input);
return 0;
}
Of course, with more error checking. :-) Maybe this could be step #1 in
the challenge?
---
* Origin: Tanktalus' Tower BBS (1:250/102)SEEN-BY: 396/1 632/0 371 633/260 262 267 270 371 634/397 635/506 728 639/252 SEEN-BY: 670/218 @PATH: 250/102 201 99 396/1 633/260 635/506 728 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.