Search Results

Search found 4 results on 1 pages for 'catarrunas'.

Page 1/1 | 1 

  • Recursive Perl detail need help

    - by Catarrunas
    Hi everybody, i think this is a simple problem, but i'm stuck with it for some time now! I need a fresh pair of eyes on this. The thing is i have this code in perl: #!c:/Perl/bin/perl use CGI qw/param/; use URI::Escape; print "Content-type: text/html\n\n"; my $directory = param ('directory'); $directory = uri_unescape ($directory); my @contents; readDir($directory); foreach (@contents) { print "$_\n"; } #------------------------------------------------------------------------ sub readDir(){ my $dir = shift; opendir(DIR, $dir) or die $!; while (my $file = readdir(DIR)) { next if ($file =~ m/^\./); if(-d $dir.$file) { #print $dir.$file. " ----- DIR\n"; readDir($dir.$file); } push @contents, ($dir . $file); } closedir(DIR); } I've tried to make it recursive. I need to have all the files of all of the directories and subdirectories, with the full path, so that i can open the files in the future. But my output only returns the files in the current directory and the files in the first directory that it finds. If i have 3 folders inside the directory it only shows the first one. Ex. of cmd call: "perl readDir.pl directory=C:/PerlTest/" Thanks

    Read the article

  • C - struct problems - writing

    - by Catarrunas
    Hello, I'm making a program in C, and I'mm having some troubles with memory, I think. So my problem is: I have 2 functions that return a struct. When I run only one function at a time I have no problem whatsoever. But when I run one after the other I always get an error when writting to the second struct. Function struct item* ReadFileBIN(char *name) -- reads a binary file. struct tables* getMesasInfo(char* Filename) -- reads a text file. My code is this: #include "stdafx.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> int numberOfTables=0; int numberOfItems=0; //struct tables* mesas; //struct item* Menu; typedef struct item{ char nome[100]; int id; float preco; }; typedef struct tables{ int id; int capacity; bool inUse; }; struct tables* getMesasInfo(char* Filename){ struct tables* mesas; char *c; int counter,numberOflines=0,temp=0; char *filename=Filename; FILE * G; G = fopen(filename,"r"); if (G==NULL){ printf("Cannot open file.\n"); } else{ while (!feof(G)){ fscanf(G, "%s", &c); numberOflines++; } fclose(G); } /* Memory allocate for input array */ mesas = (struct tables *)malloc(numberOflines* sizeof(struct tables*)); counter=0; G=fopen(filename,"r"); while (!feof(G)){ mesas[counter].id=counter; fscanf(G, "%d", &mesas[counter].capacity); mesas[counter].inUse= false; counter++; } fclose(G); numberOfTables = counter; return mesas; } struct item* ReadFileBIN(char *name) { int total=0; int counter; FILE *ptr_myfile; struct item my_record; struct item* Menu; ptr_myfile=fopen(name,"r"); if (!ptr_myfile) { printf("Unable to open file!"); } while (!feof(ptr_myfile)){ fread(&my_record,sizeof(struct item),1,ptr_myfile); total=total+1; } numberOfItems=total-1; Menu = (struct item *)calloc(numberOfItems , sizeof(struct item)); fseek(ptr_myfile, sizeof(struct item), SEEK_END); rewind(ptr_myfile); for ( counter=1; counter < total ; counter++) { fread(&my_record,sizeof(struct item),1,ptr_myfile); Menu[counter] = my_record; printf("Nome: %s\n",Menu[counter].nome); printf("ID: %d\n",Menu[counter].id); printf("Preco: %f\n",Menu[counter].preco); } fclose(ptr_myfile); return Menu; } int _tmain(int argc, _TCHAR* argv[]) { struct item* tt = ReadFileBIN("menu.dat"); struct tables* t = getMesasInfo("Capacity.txt"); getchar(); }** Thanks in advance.

    Read the article

  • Asp.net login problem.

    - by Catarrunas
    Hello, im building a asp.net web site with 2.0 framework. I've been "fighting" with web.config, i've changed it quiet some times. So to start from scracht this is what i have: <?xml version="1.0" encoding="utf-16"?> <configuration> <connectionStrings> <remove name="LocalSqlServer"/> <add name="ABC" connectionString="Database=jsilvaqqc.mdf; Data Source=213.175.208.3;Initial Catalog=jsilvaqqc;User ID=jsilva;Password=joao123#;" providerName="System.Data.SqlClient"/> <add name="LocalSqlServer" connectionString="Database=jsilvaqqc.mdf; Data Source=213.175.208.3;Initial Catalog=jsilvaqqc;User ID=jsilva;Password=joao123#;" providerName="System.Data.SqlClient"/> </connectionStrings> <location path="Members"> <system.web> <authorization> <allow users="*"/> <deny users="?"/> </authorization> </system.web> </location> <system.web> <compilation debug="true"/> </system.web></configuration> It works fine im my machine. I've created the users for the login and the role to access the "Members" folder. But in my host company, it doesnt work. I have the aspnet database from my computer in that databese "jsilvaqqc.mdf". When i try to log on pops up box requiring autentication. But i've alreadu given that in the log in form. Do i need aspnet "authentication" tag? Why dont i need it in my machine if i access the same database? Thanks for you help.

    Read the article

  • Html, hyperlink , perl, reload

    - by Catarrunas
    Hello, i have a small site in html, that calls certain functions in perl. The site has 2 pages. Page A and B. My problem is when i go from paga B to A or vice-versa, the content of the page isn't reloaded. So if i change something in page B and then go to page A, i still have the content before my changes. How can i allways force the reload and especially the execution on the perl functions that read from files? Thanks.

    Read the article

1