tokenize to put in a char* argv[] list
Hi,
I would like to have a function that would produce the same content has the main(int argc, char* argv[] ) method produces. I don't have a clue in how to do it. Can anybody give me a hint? The main problem, is that I don't know how to tokenize a string that could have a variable number of spaces that separate each word: For example: Code:
[4spaces]ls[2 spaces]-la[10 spaces]>out.txt[7spaces] Thanks, |
Or have another command like:
Code:
cat out.txt | sort |
Code:
string0 = "This is a string \n"; At the end, you will have accumulated an array of pointers, and the original string will now look like: Code:
string0 = "This\0is\0 a\0 string\0 \n"; Hope this helps. --- rod. |
This may do what you want; compile it, execute it, type a line of text and hit the return.
Code:
#include <stdio.h> |
All times are GMT -5. The time now is 01:40 PM. |