Results 1 to 2 of 2

Thread: Need some String Help

  1. #1

    Thread Starter
    Registered User jkw119's Avatar
    Join Date
    Oct 2001
    Location
    Pittsburgh
    Posts
    256

    Need some String Help

    I am trying to name a text file, but i need to name it something that varies.

    INPUTread = fopen("Type I-A.txt", "r");

    How can I name the file = m_somevariablenum " Type I-A.txt" so that it would look somthing like this "399 Type I-A.txt"


    Thanks,

  2. #2
    Frenzied Member
    Join Date
    Jul 2002
    Posts
    1,370
    Code:
    char filename[128];
    FILE *out;
    int value;
    value = 128;
    sprintf (filename,"%d Type I-A.txt", value);
    out=fopen(filename,"w");

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