Programming :: Search And Repalce A Char In Path Using Sed ?
Sep 1, 2009I have the following path wher i want to replace forward slashes with back slashes using sed path=/temp/file.tar
I am using the following but it's not working.
I have the following path wher i want to replace forward slashes with back slashes using sed path=/temp/file.tar
I am using the following but it's not working.
I'm writing an application and want to make possible to compile it with or without an optional module. This module requires perl library to be compiled, so I want to check presence of it in 'autoconf'.
The problem exists because perl library is placed in 'non-standart' location itself (like a /usr/lib64/perl5/CORE/libperl.so). So when I try to run configure (with AC_CHECK_LIB or AC_SEARCH_LIBS), it cannot find and link libperl.so in its test.
Trying to pass ./configure CFLAGS=-L/usr/lib64/perl5/CORE/ or ./configure LDFLAGS=-L/usr/lib64/perl5/CORE/
How can I define a location to search for configure's tests?
I'm writing an application with a plugin architecture and would like modify (specifically add to) the dynamic library search path while the main executable is running.
The plugin paths are not known until the application is running so I can't set LD_LIBRARY_PATH ahead of time.
My understanding (although I haven't tested it) is that the executable will only parse the LD_LIBRARY_PATH once, early on, so modifying this environment variable at runtime will have no effect.
(Note - on Windows the solution is to modify the PATH environment variable)
I know it's possible to specify the full path to load a dynamic library, and this would work if the plugin(s) only had a single library to load, but some of them will have a bunch of libraries with their own inter-dependencies, so I'd like the plugin folder(s) to get added to the search path to pick up the dependant libs.
m getting the following error when trying to compile:Quote:
$ make
g++ -march=athlon64 -O2 -pipe -fomit-frame-pointer -msse3 -c -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"undelete"' -DHAVE_SVDRP -I../../../include undelete.c
[code]...
Programming in C.I have two char arrays.char buf1[1024];char buf2[1024];Aren't buf1 and buf2 also pointers?I read in 1024 bytes into buf1 which contain about 300 bytes of characters with newlines. The data is basically a few English sentences. I'm trying to scan buf1 for newlines and then stop at the 1st newline and copy the rest of the data from that 1st newline into buf2.So I run a for loop to look for that new line.
Code:
for(i=0; i<1024;i++) {
if((strcmp(&buf1[i], "
[code]...
I am having trouble with the following exception class.
Code:
/**Standard Exception
*
*@description
*@update
*@changes
[code]....
Line 43 points at the snprintf() command.I think the error has to do with the function being virtual and the const after the function definition, however although I have been looking really hard I have not being able to find the reason nor the solution to the problem.
One workaround that I know is moving the block of source withing the virtual function, in the constructor, however having read around (boost library exceptions tutorials) it specifically said that formating of errors messages should not take place withing the construction of objects because we are risking throwing an exceptions and messing up the flow order.
i define variable of type char (range -128 to 127). when i tried to print the value after assigning a -ve value to it it displaying a +ve value of that -ve value(256+value).
View 3 Replies View RelatedWith this I may remove the last emtpy char which is not visible, coming from net, windows, ...
Code:
echo "$mystringwindowsorotherwithemptylastchar" |sed s/.$//
However if there are not then it makes a problem and delete effectively an existing char.
Code:
echo "klklj" |sed s/.$//
klkl
Anyone would have a solution for SH?
is it possible to convert a variable from char * to unsigned char ?
View 5 Replies View RelatedI've never programed shell scripting.
Code goes like so:
I simply want to read a file "data.txt" line by line Then char by char and add them into a result var. The file is supossed to always contain numeric values
I would like to run a script from any location. The script is in ~/scripts, so I added ~/scripts to my PATH. However, since I have to run it with 'sh script.sh' (due to the permissions on the directory), it doesn't seem to look in PATH for the file script.sh. Is there a way to get it to do this?
View 11 Replies View RelatedI am trying to setup DNS domain name in my server (Fedora), which has static ip address.First, I put the DNS domain name in system-config-network->DNS->DNS search path. After restarting the network, it is deleted automatically.second, so I put the DNS domain name in /etc/resolv.conf as search mydomainname . After network restart, it is also deleted automatically.In both case domain name did not work (i.e, I can't connect to my server from outside using domain name, I can by ip address, internet is working fine).However, I found that the domain name is written in /etc/sysconfig/network-scripts/ifcfg-eth0 with search=mydominaname.
View 5 Replies View RelatedI am trying to find the permissions of the directories in the $PATH variable.
I am trying to use the following:
I have a /data and /backup. on backup there is a folder called Info that has a bunch of data on it, but its not shared through Samba. So what I'm thinking is that on one of my Samba shares on data there is a folder which is really just a link to that /backup/Info folder. Is there an easy way to search through /data to see if there's a link to it, or do i have to manually go through and do a ton of ls's?
View 10 Replies View Relatedwhen i search in nautilus folder browser it search in my home path,how i can say to search in the current path?
View 2 Replies View RelatedJava applet not loading image with relative path(e.g. images/1.jpg) but loads image with absolute path(i.e. from /root/user/images/1.jpg) . This is a problem when i want to host the applet on web server
View 2 Replies View Related I just installed Netsurf, but I was confronted with "libnsbmp is not installed". So I installed libnsbmp.
The error "libnsgif is not installed" appeared when installing libnsbmp.
The error "libpng is not installed" appearded when installing libpnf.
...
I installed all that I was asked to install. However, when I was installing libcss, it said that "Package libparserutils was not found in the pkg-config search path. Perhaps you should add the directory containing 'libparserutils.pc' to the PKG_CONFIG_PATH environment variable". I have already installed libparsercutils but not in the /usr/lib dir.
What should I do to continue my installation? And anyone could tell me what are those lib stuff? I installed zlib with the apt-get install command.Can I get other lib stuff with the same command?
I need a command to search for any file in a directory like so:
/home/*/upload/* and then change permissions any file in that directory.
Find doesn't seem to match what I need.
I've setup dimdim (opensource, centos 5.3) and noticed yum & rpm commands fail when executed as root because it uses librpmio from openoffice3 instead of /usr/lib (I'm running from memory so I may have misstyped). But sudo doesn't have this problem.
How can root's search path be different, especially after I state /usr & /usr/lib at the top of /etc/ld.so.conf.
I've just built gcc 4.6.0 by myself since there is no update in Mandriva yet and I really needed the updated version, but I must be missing something in its configuration. I added ~/apps/gcc460/bin in front of my PATH, and the lib dir to my LD_LIBRARY_PATH in my .bash_profile, like so:
Code:
PATH=$HOME/apps/gcc460/bin:$PATH:$HOME/apps/bin
LD_LIBRARY_PATH=/home/duckz/apps/intel/composerxe-2011.4.191/lib/intel64/:/home/duckz/apps/gcc460/lib/
LD_RUN_PATH=/home/duckz/apps/intel/composerxe-2011.4.191/lib/intel64/:/home/duckz/apps/gcc460/lib/
export PATH
export LD_LIBRARY_PATH
export LD_RUN_PATH
I still have gcc 4.4.2 installed, but it's now hidden, so gcc --version correctly yields 4.6.0. I finally tried to build my project, all went fine, but at the moment of running it I get:
Code:
./EugGame.Release.Linux: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by ./EugGame.Release.Linux)
I assume the correct version is the one located in ~/apps/gcc460/lib, but how do I make my project load the correct lib? Is it possible at all to have two versions of gcc on the same machine? I just found that I should've added lib64 to my LD_LIBRARY_PATH instead of lib. Anyways, even if the problem is solved, I'd like to hear if my configuration is well made or if I should leave LD_LIBRARY_PATH unset and use some other way to override the default search path for stdlib.
I've modified a program to show * instead of letters when typing a password. I'm trying to make it so that when pressing backspace a * will be removed.Here's a rough example. The problem is that when trying to do this in the real program,' is not recognized as backspace.
View 6 Replies View RelatedI'm writing the Diffie-Hellman key exchange system using GMP to handle big integers. For the most part, everything works. I can convert the string to mpz_t, set up the keys and everything, and encrypt it fine. Its the decrypting I'm having issues with. What I'm using is mpz_xor() for both. To encrypt I'm doing mpz_xor(buffer, mpz_of_text, secret_key), and to decrypt I'm doing mpz_xor(buffer, mpz_of_cipher, secret_key).
For one character, it semi-works...it'll decrypt it fine, but it'll return it as it's ASCII value (i.e.: if I encrypt "A", it'll decrypt it as 65). Which, I can easily just do sprintf(decrypted_buffer, "%c", 65) for example and be fine. But, when I'm sending text bigger than one character, the encryption for AB gives me something like 1061043 after running the decrypting xor on it.
Has anyone ever done this before or can point me in some directions? Perhaps other algorithms to try? I know XOR isn't the most secure encryption method to use, but at the time I wasn't sure what else to use. I'm really just having a hard time trying to convert a mpz_t to a character string. I've looked at mpz_get_str() and it works before running encryption (i.e.: using mpz_set_str() to create a mpz of a string, then calling mpz_get_str() to change it back). Maybe my XOR method is wrong? Here's the code I'm using:
Code:
/**
* str2mpz()
* b The current buffer of text to convert [in]
* m The mpz_t variable to store converted text [out]
[code]....
I have a char*[] array:
Code:
char* myarray[] = {"Hello", "there!", "LQ"};
and I wish to use/ write a function to find the number of elements in myarray (in this case, its 3).
*equivalent of .NET's array.size() that returns number of elements in array
How do I achieve it?
Below I've presented the declaration, definition and the calling method of a function w.r.t pass by reference:
Declaration
Code:
void getUnpackedMsg (unsigned char &data, unsigned int numberOfBits);
Definition
line 278: Shown in RED
Code:
void packedMessage :: getUnpackedMsg (unsigned char &emptyArray, unsigned int numberOfBits)
{
...
...
printf ("
[code].....
What could be a command to erase from the cursor up to the first non-blank char in vi (or vim)?
View 3 Replies View RelatedBefore reboot,
$ cat /etc/resolv.conf
; generated by /sbin/dhclient-script
nameserver 172.20.10.22
search mycomp.local myhost.com
After reboot, the search path in resolv.conf is overwritten by the hostname.
$ cat /etc/resolv.conf
; generated by /sbin/dhclient-script
nameserver 172.20.10.22
search penguin
I am trying to simulate a shell. So what I do is checking of having the parameters from standard input, suc as "/bin/ls -l /home/france/Documents", and then passing them to function execute, which at some point calls execvp(argv[0],argv)The problem is that I don't succeed in using these arguments, while if I call execvp(paramList[0],paramList) it works!!!! Where paramList is exactly what I would put on standard input, but defined statically.
Code:
#include<unistd.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
[code].....
I am a dummy in C programming. I have a problem with copying the array of 64 elements of unsigned char to array of 8 element of uint64_t. For example:
unsigned char p[64]
uint64_t Data[8];
memcpy (&Data, &p, 64);
I am not sure if it is right. Please help me. Thanks a lot.Moreover, do both p and Data have 64 bytes?
This works for "char" but i need "char*",how do I do it?
Code:
char* tk = (char*) calloc(ctk+1,sizeof(char*));
Error when I use it:
Code:
error: invalid conversion from har* to har
I would like to create a small C tool. I encounter a problem of how to make a function to check an input chars contains numbers (started from the second element).
Some samples:
char *mychar= "a3547"; (The result of function checking this is true)
char *another_char = "t6548"; (The result of function checking this is true)
char *next_char = "appl3"; (The result of function checking this is false)
char *new_char = "b1aa3"; (The result of function checking this is false)