String handling in .txt file.
From: David Flick (df_at_nospamme.com)
Date: 01/31/05
- Next message: xeno: "Re: Exceptions?"
- Previous message: Alwyn: "Re: A question on efficiency"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 31 Jan 2005 11:43:48 GMT
It has been nearly two decades since I used C. I am therefor a bit out of
touch. A program we have been using since 1998 that was written in a mix
of C and C++ now needs to be modified. It appears the original code may
have been developed with some compiler specific syntax. At present I am
down to just a few syntax errors and am hoping for the final nudge. This
is what I am trying to do.
Each morning we need to hand carry a disk with information and import the
message stream into MS Outlook. From there the Inbox is exported to a DOS
comma delimited file (msg.txt). We then run the routine against the comma
delimited file which produces another .txt file (msghdr.txt) to print the
message headers.
These are the points I am stuck on:
1) fprintf(opfile,"\t List for ");
fprintf(opfile, "%d/%d/%d.\n", d.da_mon, d.da_day, d.da_year);
Should send a literal and system date to the output file. The date
formatting does not matter so long as it is a commonly recognizable date
format. I would think it a simple matter to get a system date, but my
reference books take me on a really long trek to develop date classes and
so on.
2) fprintf(stdprn,"\f\t\t Message List (Page #%d) for %d/%d/%d.\r\n\n",
page, d.da_mon, d.da_day, d.da_year);
Syntax check produces an error pointing to stdprn. I just need a plain
text stream to a printer on LPT1.
3)while (!kbhit());
Syntax check objects to kbhit. It is not necessary to wait for a key
press, but it would be a nice to know thing for the future.
4) Occasionally in the download stream there are two embedded ASCII 26
characters that cause the routine to abort. When that happens I have been
going in with Notepad to manually delete the offending characters before
proceeding. How would I go about introducing error checking for non-
printable characters. The pattern always appears as NNNN<ASCII 26><ASCII
26> at the end of each message in the body of the .txt file.
I have managed to get around all the other problems from the original code.
We do not have the developer's notes from 1998. It appears he may have
used a Borland compiler, but again we do not have the original compiler to
simply try running the code against it as is. Just the .cpp and .exe
files.
TIA
Dave
- Next message: xeno: "Re: Exceptions?"
- Previous message: Alwyn: "Re: A question on efficiency"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|