|
-
Jan 10th, 2012, 11:24 AM
#1
Thread Starter
Fanatic Member
Convert char* to char[] ?
I know this should be easy but I can't figure it out, how can I convert a char* to a char[] array? I'm not using CLR or MFC.
Here's what I have so far, using main ( int argc, char* argv[] )
char inchar[33];
char tempchar = 'a'; /* dummy value to start */
int count = 0;
while ( tempchar != '\0' )
{
tempchar = argv[1][count];
inchar[count] = tempchar;
count = count + 1;
}
fprintf(stdout, inchar);
When I run it like PROG.EXE DOG
I get only D as the output ( the first character only every time ).
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
|