Programming :: C++ List Regular Files Function Failing Inconsistently?

Mar 28, 2011

I've got a problem with a piece of code. Basically, I use my listRegularFiles function in two separate places in my code. The first time I run itit appears to work perfectly well. If I use it a second time, however, it blows a gasket. I'll post my code below, and if anybody has any ideas,Here's the code for listRegularFiles:

Code:
string listRegularFiles(char* dirname)
{

[code]...

View 2 Replies


ADVERTISEMENT

General :: List/find All Regular Files In All Subdirectories Excluding Binary Files

Oct 5, 2010

I know I can do find . -type f, but that includes binary file and I couldn't find a way to exclude them with find

View 4 Replies View Related

Server :: Config Apache Server To List Php, C/c++, Java Files As Regular Txt On Website?

Feb 2, 2011

I try to config my apache server to list all my files: c/c++, php, java files, like the txt file on my server,

e.g /var/www/mydomain/pub

i want to dump all my c/c++, php, java file under the pub directory and I can access it from my domain name,

if I dump txt file, I have no problem to view it, but when I dump c/c++ or php files under pub directory, then I can't view it like regular txt file,

Q: is there anyway I can configure my apache server to view all the c/C++, php, java file as like txt file?

View 1 Replies View Related

Server :: Config Apache Server To List Php / C/c++ / Java Files As Regular Txt On Website?

Feb 23, 2011

config my apache server to list all my files: c/c++, php, java files, like the txt file on my server, e.g /var/www/mydomain/pub i want to dump all my c/c++, php, java file under the pub directory and I can access it from my domain name, if I dump txt file, I have no problem to view it, but when I dump c/c++ or php files under pub directory, then I can't view it like regular txt file, Q: is there anyway I can configure my apache server to view all the c/C++, php, java file as like txt file?

View 1 Replies View Related

Programming :: Downloading A List Of Files From A Remote Server Using A List?

Feb 10, 2009

I am trying to get this script to work. The purpose is to download a list of modules from the slax.org the list consist of a list of module numbers. What I am trying to do is Download the file or the file name corresponding to the number in the list.the list is comma delimited. this is what I have done so far and I am a stand still.

#!/bin/sh
# Wget script to retrieve modules from slax.org modules
#
# ----Begin of user defined values -----
# Path to wget

[code].....

View 7 Replies View Related

Programming :: Regular Expression Double Escape For Files That End With .la ?

Mar 18, 2010

I have been battling with regular expressions and am a little lost. I want to find all my files that end with .la and have been trying this

Code:
slocate -r .la$

which finds them but also files like mozilla. The escaped full stop seems to be ignored however this works :

Code:
slocate -r \.la$

so why is the double escaping needed ?

View 3 Replies View Related

Programming :: Sed Regular Expression - Write Script To Edit Text Files?

Jun 29, 2010

I am trying to write a script to edit text files formatted like this:

Code:
(MCAL@Contig766:0.30207,CGIG@CVIR_Contig1014:0.13977,(HASI@HDIS_Contig573:0.16828,(CAPI@LCIN_5594371:0.36581,CFOR@FQH745302RIQ7Y:1.91244)0.160:0.00019)0.939:0.15648);
There are never line breaks or spaces in the actual files.

I want to delete all instances of the character "@" and everything between it and the next "," (including that comma) or the next ")" (including that close parentheses) whichever comes first. My desired output file would be like this:

Code:
(MCAL,CGIG,(HASI,(CAPI,CFOR)0.160:0.00019)0.939:0.15648);
I figured out how to do this using sed for either "," or ")" but both looking for whichever comes first.

View 6 Replies View Related

Programming :: Bash Function For Searching Files ?

Jun 15, 2011

I'm making a small script for searching and doing some operations with photos, but I'm kinda stuck on this little function:

Code:

function findallformat {
prefix=""
if [ $1 = -pre ] then

[code]....

That function should find for every file with a certain type; and you can specify a prefix using a "-pre" followed by the prefix that you want to search. The format should be "stackable", so you can use as many types that you want, without repeating the same function on the code.

Example: findallformat -pre IMG_ .JPG .CR2 #That should search files that start with "IMG_" and finishes with .JPG and .CR2. My problem it's that, when I try to use it on the script, it says "bash: syntax error near `token' unexpected `}'"

View 4 Replies View Related

General :: Building A Regular Expression For Use In Split Function?

Apr 1, 2011

so I have a perl script that contains an array like this:@hostNames = (ABC123R:192.168.1.1, CBA321CBP:192.168.1.2, ZYX987R:192.168.1.3, etc firstelement"ABC123R:192.168.1.1":ABC123R is the hostname and 192.168.1.1 is it's IPaddress.I am trying to write a regular expression that will split the element with a '-' wherever there is a LETTER next to a NUMBER, like so:ABC-123-R:192.168.1.1I tried this expression below but am struggling with using regex for slightly complicated matching criteria:

for ($x = 0; $x < scalar(@hostNames); $x++)
{
$hostNames[$x] = split /([A-Z][0-9])/, "-"

[code]....

View 2 Replies View Related

Debian Configuration :: Make Localmodconfig Failing To Function Properly?

Aug 23, 2010

The announcement of several new make scripts in the 2.6.32 release notes is very exciting.1.8. Easy local kernel configuration.Most people uses the kernel shipped by distros - and that's good. But some people like to compile their own kernels from kernel.org, or maybe they like following the Linux development and want to try it. Configuring your own kernel, however, has become a very difficult and tedious task - there're too many options, and some times userspace software will stop working if you don't enable some key option. You can use a standard distro .config file, but it takes too many time to compile all the options it enables.

To make easier the process of configuration, a new build target has been added: make localmodconfig. It runs "lsmod" to find all the modules loaded on the current running system. It will read all the Makefiles to map which CONFIG enables a module. It will read the Kconfig files to find the dependencies and selects that may be needed to support a CONFIG. Finally, it reads the .config file and removes any module "=m" that is not needed to enable the currently loaded modules. With this tool, you can strip a distro .config of all the unuseful drivers that are not needed in our machine, and it will take much less time to build the kernel. There's an additional "make localyesconfig" target, in case you don't want to use modules and/or initrds.

View 1 Replies View Related

Programming :: How Can A Friend Function Access A Public Function From A Base Class

Nov 16, 2010

Code:
#include <iostream>
using namespace std;

[code]...

View 1 Replies View Related

Programming :: Passing Data From Interrupt Handler Function To Tasklet Function?

May 18, 2010

I am doing some Linux kernel programming for my research project. I need to record the timestamp (by using cpuid and rdtsc) when an interrupt handler (top half) is first invoked. Due to the time critical nature of the problem itself, I have to do the timestamping inside the interrupt handler itself (the first operation when the handler is called). However, I understand that tasks that are not so time critical should be deferred to a tasklet function (bottom half) for processing because other interrupts are disabled in a (top-half) interrupt handler. I am currently out of idea on how I can pass the timestamp information that I have obtained in the interrupt handler to the corresponding tasklet function.

View 2 Replies View Related

Programming :: List Files In Bash + Add Url Before Them?

Dec 8, 2010

I am an uploader to a various hosts, so this tiny script me a lot. I make a rar archive and split files with 100mb. I could get 3-4 or even 76 parts of rar files and it would take me some time to paste all these urls to remote upload function of filehosting sites. For example:

Code:

server:/home/cober/downloads/teevee# ls -al
total 358784
drwxrwxrwx 2 root root 4096 Dec 8 19:38 .

[code]....

View 1 Replies View Related

Programming :: Awk - Display From The List Of Files Given As Parameters

Mar 12, 2011

I have to display from the list of files given as parameters the name of the file with the largest number of words and their number.(with AWK)

View 2 Replies View Related

Programming :: Rename Files Matching A List?

Jul 12, 2009

Is there a way, preferably in python or BASH, to rename files from a list? for instance, track1.mp3, track2.mp3 should be renamed to the names stored in a file listing song names. I have tried to loop a variable through directory listing and renamed them, only to find that filenames with spaces can't be assigned to a variable as a whole. To solve the problem above, I have tried the read command in BASH, which enables the program reading line by line from a list. However, It was failed to pipe the results from directory listing to the read command.

View 14 Replies View Related

Programming :: List Only Hidden Files In Current Directory?

Feb 15, 2010

How to list only hidden files in current directory ?

View 2 Replies View Related

Programming :: List All The Files That Don't Contain Pattern1 And Append A New String?

Mar 24, 2011

How to list all the files that don't contain pattern1 and append a new line (pattern1) to those files before pattern2 only once.

pattern1 = /var/script/showMessage.sh
pattern2 = ;;

Code:
grep -c 'pattern1' /var/script/*_cam* | grep :0 | add pattern1 before pattern2 in each file loacted before.

View 10 Replies View Related

Programming :: List Specific Files And Delete Results?

Jul 8, 2011

I ran the command:

Code:

ls -ltr | head -n40

I'd like to delete all the files listed...

View 2 Replies View Related

Programming :: Make List Of Directories Which Contain Files Other Than Subdirs?

Oct 17, 2009

I need to, through a bash script, go through a given directory (given as argument 1) to list out the relative path in this directory (including $1) for eact subdirectory which contains files. Directories which only contain . .. and eventually only subdirectories SHALL NOT be listed. It is this last requirement that makes it difficult for me.

I have been using the tree command for now, but I have not found a way to ignore paths to directories which only contains other subdirs or nothing at all in any easy way. I may offcourse test each directory after they are listed but this gives an extra loop to go through and I beleive it should be possible to do it directly when creatring the list. I guess by using find or ls in conjuntion with the tree command or by itself it should be possible but I am not to conversant of nested script commands.

View 9 Replies View Related

Programming :: Bash: Populate A List Of Arbitrarily Named Files?

Mar 14, 2010

How to build a list of files under a directory that may have any permissible characters in the name, that is anything except NUL? The only possible (?) bash data structure to contain a list of such names is an array because NUL cannot be used as a list item separator so no X-separated list can safely be used; there is no "X" that might not be part of a file name. OK -- but how to populate such an array? Here's what I've tried.

Code:

#!/bin/bash
# Set up test files
dir=$(mktemp -d "/tmp/${0##*/}.XXXXXX")
touch $dir/foo $dir/bar

[code].....

View 10 Replies View Related

Programming :: BASH Read Text List Zip Files Into A Single Archive?

Jul 22, 2010

AKA "zipping on the fly .. the slow-as-molasses way." The list includes full pathnames to each file, and they're all in subfolders of the same parent folder (which, unfortunately, is not the root folder of the drive or system on which the files reside). A cleaned-up and radio-ready portion of the list looks like

Quote:

.../taiga/ahqr-va-choyvp/bv0884-073.jpg
.../taiga/ahqr-va-choyvp/bv2635-073.jpg
.../taiga/ahqr-va-choyvp/bv3067-175.jpg

[code]....

What I'd like to be able to do is zip all the files in the list into a single archive, to avoid the step of having to copy them to the same location (presumably another folder on the HD) and then zip that folder. I'm more inclined to make provisions about extracting to a single folder at some other time. Is this possible in BASH, or would I have to consider a faster, more robust scripting language such as python or perl?

View 8 Replies View Related

Programming :: Make A Program That Maintains A List Of Tags That Can Be Attached To A Set Of Files?

Jul 28, 2010

I want to make a program that maintains a list of tags that can be attached to a set of files. Store the tags in the files. The main problem is that there is no way to get a list of all the tags without reading each and every file. And also what if you have an unused tag? Have a file that contains tag "keys" and file list "values". This seems like it would be fast and effective, but what if one of the files gets renamed?

View 12 Replies View Related

Programming :: Declaring A Function In A Function - C Programming

May 24, 2010

I want to declare a function in a function, but had no success till now, see the error code below and visit the project at sourceforge

[Code]...

View 14 Replies View Related

Programming :: Bash Array Add Function Example Using Indirect Array Reference As Function Argument?

Jun 20, 2010

I looked on the net for such function or example and didin't find anything, thus after having made one i guess it would be legitimate to drop it to see what others thinks of it.

#!/bin/bash
addelementtoarray()
{
local arrayname=$1

[code]....

View 10 Replies View Related

General :: Hex Values Converting Inconsistently?

Dec 19, 2010

I couldn't really decide where this should be posted, but this is the most general of the forums. Anyway, I've been playing a wargame on intruded.net in which some of the challenges require me to pass hexvalues into the programs as character values. All is well with this, and usually I would use the shell to pass it in, but most of these programs use the gets() method to get my input.

Here comes the problem... The other day I was using my desktop which runs slackware 64 13.1 to do these challenges. My method was to use "echo -e 'xefxbexadxde'" to print them to the shell's standard output and then highlight and copy the resulting values to paste to the program. This works just fine on slackware, but when I repeated the same processes on Ubuntu 64 10.04 (which runs on my laptop) the 'xde' always turns up to be 'x00'. Then I tried some other levels with similar responses, not all the hex values convert to the correct ASCII characters.

View 2 Replies View Related

OpenSUSE Install :: List Available Of Core Applications Required To Function?

Apr 9, 2010

OpenSUSE 11.2 installation DVD has many many applications that are installed by default.How can I install just the minimum for a working system. As an excercise I am trying to build a Nas system which I can install into our Windows Active Directory at work and have user access controlled via an Active Directory user group. I have no need therefore for so many of the applications available. I have tried uninstalling some applications and have managed to remove some features that I infact needed to keep.just a minor thing like the Gnome interface (gee!). Is there a list available of core applications required to function etc. that would help me to streamline my build?

View 9 Replies View Related

Ubuntu Multimedia :: Flash Stops Working Inconsistently?

Sep 23, 2010

I'm running Ubuntu 10.04 64bit.

This happens on Chrome and Firefox.

When I'm running a flash site like, Pandora, it stops working when I open another tab with flash running like, Hulu. Now it doesn't stop working right away but in time it does.

Then screen on that tab usually goes grey.

Now this doesn't happen all the time but enough to get me flustered.

View 5 Replies View Related

Programming :: List 4 Names From Users List And Output Them To Fbusers In Numbered Ascending Order?

Feb 2, 2010

How would I list 4 users ID numbered 10, 11, 12 and 13 from my users list and output them to a file busers where their names are numbered by ascending order? How would I accomplish that on a one line command?

View 4 Replies View Related

Programming :: Ant Build.xml And Regular Expressions?

May 31, 2011

i am trying to create an exclude regular expression for my build.xml. The problem is, that i am trying to find some info on which REs are acceptable/valid for ant... Is ant using standard regular expressions? POSIX ones? Since it is a java-based tool, the "Java REs" are probably valid. I am a little bit confused. If somebody can help me out with the different RE standards, i would be most obliged.

View 1 Replies View Related

Programming :: Using Regular Expressions With Find?

Mar 17, 2010

Gidday, I'm puzzled as to why this works:

Code:
find /Data/ -type f -iname "*7pm*"
But this doesn't:
Code:
find /Data/ -type f -regex *7[Pp][Mm]*

I've tried MANY variations, but I'm getting no error messages, just no returns, and yet the first find, will find the sorts of files I'm looking for. I realise a win is a win, but I'm of the understanding that the -regex switch allows for some really complex use of regular expressions - but I can't even get a very simple one to work,

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved