How do I know how many files passed to cmd?

I need help.
I know the functions argv , argc but how can I know how many parameters passed to the cmd ?

if I have for example 3 txt files then my argc needs to be equal to 4 but when I'm placing them in the directory I"m getting argc=1 so it means I'm not passing the txt files to the cmd...

If someone can give me a good example I'l be glad.

thenks a lot.
Last edited on
closed account (S6k9GNh0)
1. argv and argc aren't functions and although I know what your talking about, argv and argc really doesn't define anything in C/++.
2. Now, if you put 4 spaced words in front of your executable name, you will have 5 parameters passed to main. What are you passing to your program exactly?

3. Why don't you show us an example so we can be sure on what you're talking about?
I need to pass txt files (as mutch as I want - dinamic) to my main and then allocate a dinamic array according to the number of txt files that the main got.

after that i need to load informaition from the txt files and to keep on whit the program...

I need to understand what do I write and where ...
I attached some pic from my cpu for you so you maybe can direct me to the solution.

Thanks a lot and I really appreciate it.

[URL=http://www.israup.net][IMG]http://www.israup.net/images/2b61b8c037498389c5a9eb8e0f015188.png[/IMG][/URL]

[URL=http://www.israup.net][IMG]http://www.israup.net/images/d2391aa6ec256474509f17675648a997.png[/IMG][/URL]

[URL=http://www.israup.net][IMG]http://www.israup.net/images/91e213f42ddb31d623556d0cfaf9827a.png[/IMG][/URL]
Last edited on
Topic archived. No new replies allowed.