On Tue, 21 Aug 2007 22:42:24 -0700,
ro******@gmail. com wrote in
comp.lang.c:
Hi,
I am running a command like the one given below through a process:
What's a process? Do you mean a C program? Are you passing a string
to the system() function?
abc d:\myfolder\xyz _%s.*.log . -now the %s puts a string which may
or may not contain white spaces...
e,g abc d:\myfolder\xyz _EARTH LIFE.*.log
how should i confirm that that the entire string should be taken into
consideration along with the white space in between to run the command
abc on the file xyz_EARTH LIFE.123.log?
Please help....
If you are using the standard C function system(), it depends on your
system's command interpreter or shell, as this is what will actually
parse the string.
If a file name that you pass to the system function might contain
spaces, your shell might need you to quote it. So instead of:
sprintf(buffer, "abc %s", file_name_that_ might_contain_s paces);
....you might try:
sprintf(buffer, "abc \"%s\", file_name_that_ might_contain_s paces);
If that does not work for you, or you are using some method other than
the standard C library system() function, post in a group that
supports your particular platform.
--
Jack Klein
Home:
http://JK-Technology.Com
FAQs for
comp.lang.c
http://c-faq.com/
comp.lang.c++
http://www.parashift.com/c++-faq-lite/
alt.comp.lang.l earn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html