Sponsored Content
Top Forums Programming C programming + problem with char arrays Post 302209440 by JamesGoh on Friday 27th of June 2008 01:21:18 AM
Old 06-27-2008
Gday all

Ive managed to get it to work now, however this involved replacing the char * with char[] (I was using char pointers beforehand to contain the full path of the folder).

Also Im aware you can reference pointers as if they were an array, so could the problem I was getting in the firstplace be related to the way I was referencing ?
 

10 More Discussions You Might Find Interesting

1. Programming

char array problem

hello i have a program in C (Unix - SOlaris5.7), and i have the next question: i have a lot of char variable, and i want store their values in a char array. The problem is what i donīt know how to put the char variable's value into the array, and i don`t know how to define the array please... (4 Replies)
Discussion started by: DebianJ
4 Replies

2. Shell Programming and Scripting

Problem with arrays in awk

Hello! I'm trying to make a script that will make a list of the files in a source tree and sort them by size. Problem is I've run into a weird problem. print array will give me numbers like 160, 220, 444 that i don't even know where they come from, and print array will give me the correct numbers... (5 Replies)
Discussion started by: Glauco
5 Replies

3. UNIX for Dummies Questions & Answers

Problem assigning variables to arrays

Hi All, I have a problem assigning variables to script.I have a script in which i have a while loop now i have to assign some values obtained to an array which will be used later in the script.Can anyone help how to do that. At present my scrot looks like: co=0 pco=0 co=`cat /tmp/highcpu... (4 Replies)
Discussion started by: usha rao
4 Replies

4. Programming

char problem ?

Here is a C function that replaces some non-ASCII chars to html decimal entities. It seems that the char "į" does not get replaced correctly but the rest do. Any idea why this is happening ? (Please note that I had to place a space before each ; or they would not post correctly in this forum... (7 Replies)
Discussion started by: cyler
7 Replies

5. Programming

Char arrays

This is in C++. Is there a way to take characters out of input data? For example, hello 0 1 2 3 4 5 is within my double dimensional array: char arr; How would I output only the characters h,e,l,l,o? (0 Replies)
Discussion started by: puttster
0 Replies

6. Shell Programming and Scripting

Problem with arrays

Hi I have two arrays: arr1 = (demo demo2 demo3 demo4 demo5) arr2 = (demo2 test demo) I want to check that the values the "arr2" are present in "arr1" Example arr1 = (demo demo2 demo3 demo4 demo5) arr2 = (demo2 test demo) Output: Error arr1 = (demo demo2 demo3 demo4 demo5)... (3 Replies)
Discussion started by: blito_loco
3 Replies

7. Shell Programming and Scripting

Problem with arrays and loop

Hello , im sorry for my english . im trying to create a dynamic menu that will display if the interface is ACTIVE OR STOPPED/FAILED for some reason i cant get it to work properly start_interface_func() { i=0 for interface_chk in 11 71 73 72 12 47 48 49 50 20 23 24 25 46 21 22 27 28... (5 Replies)
Discussion started by: visiown
5 Replies

8. Programming

problem in multiplying arrays

Hi, this is my code.It's simple : there are 2 2D arrays and the multiplied to C. #include<stdio.h> #include<sys/shm.h> #include<sys/stat.h> #include<stdlib.h> main() { int *A; //A int *B; //B int *C; //C int i,j,x,k,d; int id; ... (17 Replies)
Discussion started by: giampoul
17 Replies

9. Programming

STL algorithm merge() function to concatenate char arrays

When the STL generic algorithm's merge() function is used to merge two char arrays, the output is not as expected. Below is the program I tried with. #include <iostream> #include <algorithm> #include <cstring> #include <deque> #include <iterator> using namespace std; int main() { ... (3 Replies)
Discussion started by: royalibrahim
3 Replies

10. Shell Programming and Scripting

Multidimensional arrays Shell Programming and Scripting

I have two files: file-1 is a list of number of interfaces in the switch and file-2 have VLAN-ID , VLAN-NAME , Interface belong to that VLAN like this: file-1: 1/1 1/2 1/3 1/4 1/5 . . file-2: 1,"vlan-wifi",1/1,1/7,1/8 (9 Replies)
Discussion started by: SULTAN01
9 Replies
Tcl_SplitPath(3)					      Tcl Library Procedures						  Tcl_SplitPath(3)

__________________________________________________________________________________________________________________________________________________

NAME
Tcl_SplitPath, Tcl_JoinPath, Tcl_GetPathType - manipulate platform-dependent file paths SYNOPSIS
#include <tcl.h> Tcl_SplitPath(path, argcPtr, argvPtr) char * Tcl_JoinPath(argc, argv, resultPtr) Tcl_PathType Tcl_GetPathType(path) ARGUMENTS
const char *path (in) File path in a form appropriate for the current platform (see the filename manual entry for acceptable forms for path names). int *argcPtr (out) Filled in with number of path elements in path. const char ***argvPtr (out) *argvPtr will be filled in with the address of an array of pointers to the strings that are the extracted elements of path. There will be *argcPtr valid entries in the array, followed by a NULL entry. int argc (in) Number of elements in argv. const char *const *argv (in) Array of path elements to merge together into a single path. Tcl_DString *resultPtr (in/out) A pointer to an initialized Tcl_DString to which the result of Tcl_JoinPath will be appended. _________________________________________________________________ DESCRIPTION
These procedures have been superceded by the objectified procedures in the FileSystem man page, which are more efficient. These procedures may be used to disassemble and reassemble file paths in a platform independent manner: they provide C-level access to the same functionality as the file split, file join, and file pathtype commands. Tcl_SplitPath breaks a path into its constituent elements, returning an array of pointers to the elements using argcPtr and argvPtr. The area of memory pointed to by *argvPtr is dynamically allocated; in addition to the array of pointers, it also holds copies of all the path elements. It is the caller's responsibility to free all of this storage. For example, suppose that you have called Tcl_SplitPath with the following code: int argc; char *path; char **argv; ... Tcl_SplitPath(string, &argc, &argv); Then you should eventually free the storage with a call like the following: Tcl_Free((char *) argv); Tcl_JoinPath is the inverse of Tcl_SplitPath: it takes a collection of path elements given by argc and argv and generates a result string that is a properly constructed path. The result string is appended to resultPtr. ResultPtr must refer to an initialized Tcl_DString. If the result of Tcl_SplitPath is passed to Tcl_JoinPath, the result will refer to the same location, but may not be in the same form. This is because Tcl_SplitPath and Tcl_JoinPath eliminate duplicate path separators and return a normalized form for each platform. Tcl_GetPathType returns the type of the specified path, where Tcl_PathType is one of TCL_PATH_ABSOLUTE, TCL_PATH_RELATIVE, or TCL_PATH_VOL- UME_RELATIVE. See the filename manual entry for a description of the path types for each platform. KEYWORDS
file, filename, join, path, split, type Tcl 7.5 Tcl_SplitPath(3)
All times are GMT -4. The time now is 10:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy