Results 1 to 8 of 8

Thread: Combine 2 strings

Threaded View

  1. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Code:
    #include <iostream>
    #include <time.h>
    #include <stdio.h>
    using namespace std;
    
    int main()
    {
    FILE *t;
    char PATH[256];
    strcpy(PATH,  "c:/");
    strcat(PATH, ctime(time()));
    strcat(PATH, ".txt");
    t=fopen(PATH,"r"); // this could cause problems: "rt" would be preferred
    fclose(t);  // change here
    return 0;
    }
    ctime takes time_t as argument, not time_t*.

    probably logical error: you're opening a file for reading that will most likely not exist.
    Last edited by CornedBee; Nov 25th, 2001 at 03:24 PM.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width