Yeah forgot about that, that is funny. Wound up not need it back then. Never had figured it out though.
I've tried to recompile, but it's calling for all sorts of includes and other...
Type: Posts; User: chops11
Yeah forgot about that, that is funny. Wound up not need it back then. Never had figured it out though.
I've tried to recompile, but it's calling for all sorts of includes and other...
Yes. It's a 15 year old piece of code that I own and need to run. Doesn't seem that unreasonable to me.
I have all 5k lines of code. I'd be happy to post it, but didn't think it was...
Good Morning.
Have an ancient piece of code that a programmer that hasn't worked for us in over 10 years wrote. We had him put some security measures in where if files were tampered with, it...
As I said, not much of a programmer.
This grabs a line at a time correct and would be my solution?
int ready = 0;
char buf[100];
while (fgets(buf, sizeof(buf), infile))
Great, can do that for sure:
while ( fscanf(infile, "%19s%*c", text) == 1 )
{
if ( ready )
{
if (strcmp(text,antipattern)==0)
{
No familiar with it. So it looks like it'll returns at what position it finds a match. Best way to use an If > in order to say, found a match, continue?
Yes I guess that would be a solution. I was just hoping there was a way to search an entire string for a phrase.
Truth is i'm not much of a programmer, so was trying to edit the code the least.
...
Good Morning.
I've been using the following code where I key on a phrase "pattern", and redirect all the needed data until I hit the "antipattern". Code as follows:
if ( infile != NULL )...
Afternoon all,
Came upon a problem needed at work where i'm having some trouble programming the solution. They are looking for a simple program which takes entry of a 6 digit "number" as a...
Thank you itsme for your time and patience.
So if the code is as follows:
FileStat.st_mtime = 0l;
stat("infile",&FileStat);
time(&chktime);
if(FileStat.st_mtime+7776000l<chktime...
Thank you itsme for your time and patience. I jsut realized that the first snippet:
FileStat.st_mtime = 0l;
stat("infile",&FileStat);
time(&chktime);
...
I just don't understand what 535523774 is equal to in terms of last modified date.
If it's seconds, then it's 6198.1918 days. Do I have to figure what's that many days past Janurary 1st 1970 in...
Jim thanks a million for the help. The value chktime isn't specified anywhere else in the code. It is defined:
long int chktime;
but that's it.
Does that not make sense?
Hello all,
I am editing a piece of code that has the following:
FileStat.st_mtime = 0l;
stat("infile",&FileStat);
time(&chktime);
if(FileStat.st_mtime+7776000l<chktime ){
...
That's exactly what I did.
Thank you all for taking the time to explain.
Understood, didn't realize it. I'll bump the buffer up to 100.
Thank you!
Yes stdio.h is included.
\cut - cut is the name of the program, just prompting the user on what the sequence on the command line should be.
on error prints:
cut [column] [file to scan] [file...
25
void main(int arcg, char *argv[])
{
char buf[25];
char file1[20] = " ";
Dave,
Thank you, but that turned input like this (using 8 as the command line number, and 6 as the hardcode number):
1234 ZZ 123456 XXXX.XXXX.XXAAAAAAXXXXXX.XXXXX.XXXXXBBB
into output...
Hello there all. I have a small program I wrote (with help of some here). If takes a number from the command line and then parses a file based on it. For example:
If you gave the number 3 and...
I think I may've just gotten it going:
while(!fgets(buf, sizeof(buf), infile)); //first line of file right?
if(!strncmp(buf, "hello", 5)) //if it's hello, move on
{
...
So what am I doing wrong here?
if(!fgets(buf, sizeof(buf), infile)); //first line of file right?
if(!strncmp(buf, "hello", 5)) //if it's hello, move on
{
...
dwks don't you want to help me? :)
Ran into another little snag with this one. Realized that two different streams may come through. For example i may have the original:
hello
num12b3
non123902
bcr129302
num48203
num12309d3...
Thanks for your help dwks, I believe I figured it out above, does that look correct?