[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Modificering af streng i funktion



Jeg har et program ala dette

main(int argc, char **argv)
{
	char filename[256];

	parse_args(argc, argv, &filename);

	printf("main: %s", filename);
	
	...
}

void parse_args(int argc, char** argv, char** filename)
{
	*filename = *(argv + 1);	/* Filename is always here. */
	printf("parse_args: %s, %s", *filename, *(argv + 1));
}

Jeg vil altså gerne have, at den værdi, jeg giver filename i parse_args()
forbliver den samme bagefter i main().
For det første brokker den sig over at konvertere &filename til char** , er
det ikke det samme?
Og hvorfor er værdien af filename i main() noget vollapyk, når printf() i
parse_args giver, at begge variable har samme værdi?

-- 
mvh.
Peter Seidler
sslug@sslug


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:07 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *