[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
 

Re: [CPROG] Returnerin af at "string" array



> Du kan ikke arbejde med et array af arrays af ubestemt størrelse.
> Muligvis prøver du at returnere et array af char pointere?
Tror du har ret
> Vis noget kildetekst - gerne et minimalt eksempel, som viser problemet -
> så skal du få hjælp.
ok her kommer det jeg har lavet indtil videre
/*Included Libs*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//#include <gtk/gtk.h>

/*Global Variables*/
//Global FilePointers
FILE *logfile;

//Global Strings
char *sEND = "END";
char *ENDLines[] = {};
char *test[]={};
char *retCode;
char Line[200];

/*
 * The parseLog Function:
 * Returns an array of END-tag lines. ie. list of who printed what =)
 */
char** parseLog(char *filename){
	int i = 0;
	int j;
	
	logfile = fopen(filename, "r");
	
	while(retCode != NULL){
		retCode = fgets(Line, 200, logfile);
		if(strstr(Line, sEND)){
			for(j=0;j<200;j++){
				ENDLines[i][j] = Line[j];
			}
			i++;
		}else{
			continue;
		}
	}

	fclose(logfile);
	return(&ENDLines);
}

int main(int argc, char *argv[]){
	int q;
	
	test = parseLog("lp-acct");		
	
	for(q=0;q<10;q++){
		printf("%s\n",test[q]);
	}
	
	return(0);	
}

Håber der er nogen der kan gennemskue mit problem =) Som sagt er jeg helt
ny i C og det program jeg er ved at skrive er en port af et java program

-Jesper


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 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] *