Search:

Type: Posts; User: chops11

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Thread: Code Explained

    by chops11
    Replies
    8
    Views
    1,870

    Yeah forgot about that, that is funny. Wound up...

    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...
  2. Thread: Code Explained

    by chops11
    Replies
    8
    Views
    1,870

    Yes. It's a 15 year old piece of code that I...

    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...
  3. Thread: Code Explained

    by chops11
    Replies
    8
    Views
    1,870

    Code Explained

    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...
  4. Replies
    9
    Views
    1,052

    As I said, not much of a programmer. This...

    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))
  5. Replies
    9
    Views
    1,052

    Great, can do that for sure: while (...

    Great, can do that for sure:



    while ( fscanf(infile, "%19s%*c", text) == 1 )
    {
    if ( ready )
    {
    if (strcmp(text,antipattern)==0)
    {
  6. Replies
    9
    Views
    1,052

    No familiar with it. So it looks like it'll...

    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?
  7. Replies
    9
    Views
    1,052

    Yes I guess that would be a solution. I was just...

    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.
    ...
  8. Replies
    9
    Views
    1,052

    Parsing sections out of a file.

    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 )...
  9. Replies
    5
    Views
    3,169

    Incrementing alpha characters. Base36

    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...
  10. Replies
    11
    Views
    13,007

    Thank you itsme for your time and patience. So...

    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...
  11. Replies
    11
    Views
    13,007

    Thank you itsme for your time and patience. I...

    Thank you itsme for your time and patience. I jsut realized that the first snippet:



    FileStat.st_mtime = 0l;
    stat("infile",&FileStat);
    time(&chktime);
    ...
  12. Replies
    11
    Views
    13,007

    I just don't understand what 535523774 is equal...

    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...
  13. Replies
    11
    Views
    13,007

    Jim thanks a million for the help. The value...

    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?
  14. Replies
    11
    Views
    13,007

    FileStat.st_mtime confusion

    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 ){
    ...
  15. That's exactly what I did. Thank you all for...

    That's exactly what I did.


    Thank you all for taking the time to explain.
  16. Understood, didn't realize it. I'll bump the...

    Understood, didn't realize it. I'll bump the buffer up to 100.

    Thank you!
  17. Yes stdio.h is included. \cut - cut is the...

    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...
  18. 25 void main(int arcg, char *argv[]) {...

    25




    void main(int arcg, char *argv[])
    {

    char buf[25];
    char file1[20] = " ";
  19. Dave, Thank you, but that turned input like...

    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...
  20. How to get only a certain portion of the string

    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...
  21. Replies
    15
    Views
    2,077

    I think I may've just gotten it going: ...

    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
    {
    ...
  22. Replies
    15
    Views
    2,077

    So what am I doing wrong here? ...

    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
    {
    ...
  23. Replies
    15
    Views
    2,077

    dwks don't you want to help me? :)

    dwks don't you want to help me? :)
  24. Replies
    15
    Views
    2,077

    Ran into another little snag with this one. ...

    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...
  25. Replies
    15
    Views
    2,077

    Thanks for your help dwks, I believe I figured it...

    Thanks for your help dwks, I believe I figured it out above, does that look correct?
Results 1 to 25 of 32
Page 1 of 2 1 2