|
-
February 10th, 2012, 03:54 PM
#1
Simple question about dynamic concatenation
Hi,
So I have a very simple question (I'm beginner ) about concatenation with the strcat function :
I have a program in C, I want to export a .txt file containning results, I have to put the location in a char[], I have something like that =
"
.......
GetCurrentDirectory(256, file);
strcat(file,"\\log.txt");
....
"
and it works, no problem, but I'd like to export many log files so I need dynamic concatenation, something like that :
"
.......
int x = 5;
GetCurrentDirectory(256, file);
strcat(file,"\\logx.txt");
....
"
and having a log5.txt in my file, into not erasing log4.txt for exemple ... I searched with the sprintf function for cast, but I have a problem, if I do
"
.......
GetCurrentDirectory(256, fichier);
strcat(file,"\\log");
strcat(file,".txt");
....
"
It doesn't work, I don't understand why ... I want to do strcat(file,"\\log" +x+".txt" ); like in java for exemple but I don't find how to write it ... someone knows it plz ?? =)
thx
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|