hi all
this is my code
Code:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define BUF 250
main()
{
FILE *fp;
int i;
char buffer[BUF],*guffer;
fopen("log.txt","r");
while((fgets(buffer,BUF,fp))!=NULL)
{
for(i=0;(i<streln(buffer))&&((*(buffer+1))!='\0');i++)
{
switch(*(buffer+i))
{
case ' ':
guffer=strudp(buffer+i);
}
}
}
printf("%s\n",guffer);
fclose(fp);
}
what it does is next
there is a file called log.txt
it's content is
c:\mybayby\storm\links.php
c:\mybayby\storm\yah.php
c:\mybayby\storm\soso.php
all what i want is to get the file names like links.php
then take the path and copy it
how can i do this
?
this one works but i can't modify it to work like i told you
Code:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define BUF 250
main()
{
char fi[80],gg[80];
gets(fi);
strcpy(gg,fi);
int i;
FILE *copy,*cc;
char *name;
char buffer[BUF];
for(i=0;(i<strlen(fi))&&((*(fi+i))!='\0');i++)
{
switch(*(fi+i))
{
case '\\':
name=strdup(fi+i+1);
}
}
printf("%s",fi);
cc=fopen(gg,"r");
copy=fopen(name,"w");
while((fgets(buffer,BUF,cc))!=NULL)
{
fputs(buffer,copy);
}
fclose(copy);
fclose(cc);
}
/*end of get file names copy*/
/*EOF*/
help