Sponsored Content
Full Discussion: Reg: char ptr - Coredumps
Top Forums Programming Reg: char ptr - Coredumps Post 60027 by google on Friday 7th of January 2005 12:51:28 PM
Old 01-07-2005
Code:
#include <stdio.h>
void main()
{
int Index=1;
char *Type=NULL;


Type = (char *)Index;
printf("%s",Type);

}

Well, Im still learning C just a novice. Looking at the code above though, Index does not have a new line terminus. Printf wont know when to stop printing. Is this why it cores?
 

10 More Discussions You Might Find Interesting

1. Programming

file ptr.

Is there any way to know the filename from an available file pointer. (2 Replies)
Discussion started by: bankpro
2 Replies

2. AIX

Configuring Color Laser ptr in AIX

Hi All, I have Network color laser printer which is to be configured in AIX5L. The Model of the printer is OKI C3200. Will it is supported with AIX 5..? I could not find any drivers for this. Will any compatible drivers are available for this printer... I tried with the default drivers hplj-4... (2 Replies)
Discussion started by: helloajith
2 Replies

3. Solaris

Coredumps and swap - was part of Solaris Mem Consumption

We have Sun OS running on spark : SunOS ciniwnpr67 5.10 Generic_118833-24 sun4u sparc SUNW,Sun-Fire-V440 Having Physical RAM : Sol10box # prtconf | grep Mem Memory size: 8192 Megabytes My Top Output is : 130 processes: 129 sleeping, 1 on cpu CPU states: 98.8% idle, 0.2% user, 1.0%... (39 Replies)
Discussion started by: rajwinder
39 Replies

4. Programming

int *ptr + max possible value

From reading my C book, Im aware that the integers have a maximum value which depends on what type of processor you are using (since they use 16-bit or 32-bit instructions). Now I know pointers are very flexible, since they can reference anything, but in the case of integer pointers, can they... (4 Replies)
Discussion started by: JamesGoh
4 Replies

5. Programming

Adding a single char to a char pointer.

Hello, I'm trying to write a method which will return the extension of a file given the file's name, e.g. test.txt should return txt. I'm using C so am limited to char pointers and arrays. Here is the code as I have it: char* getext(char *file) { char *extension; int i, j;... (5 Replies)
Discussion started by: pallak7
5 Replies

6. AIX

Zerofault terminates and coredumps - Segmentation fault

Hi, I am using zerofault in AIX to find memory leaks for my server. zf -c <forked-server> zf -l 30 <server> <arguments> Then after some (5 mins ) it terminates core dumping and saying server exited abnormally. I could not understand the core file generated: its something like show in below... (0 Replies)
Discussion started by: vivek.gkp
0 Replies

7. Programming

concat const char * with char *

hello everybody! i have aproblem! i dont know how to concatenate const char* with char const char *buffer; char *b; sprintf(b,"result.txt"); strcat(buffer,b); thanx in advance (4 Replies)
Discussion started by: nicos
4 Replies

8. Programming

error: invalid conversion from ‘const char*’ to ‘char*’

Compiling xpp (The X Printing Panel) on SL6 (RHEL6 essentially): xpp.cxx: In constructor ‘printFiles::printFiles(int, char**, int&)’: xpp.cxx:200: error: invalid conversion from ‘const char*’ to ‘char*’ The same error with all c++ constructors - gcc 4.4.4. If anyone can throw any light on... (8 Replies)
Discussion started by: GSO
8 Replies

9. Solaris

Cannot resolve PTR record issue

Hi guys, I am currently receiving the following output in /var/log/syslog and is occurring every second leading to /var directory being full after every 2 days. Aug 20 17:32:29 opaldn1 sendmail: r7KCOlQm002517: ruleset=check_rcpt, arg1=<postmaster@silverapp6>, relay=, reject=450 4.4.0... (3 Replies)
Discussion started by: Junaid Subhani
3 Replies

10. Programming

Invalid conversion from char* to char

Pointers are seeming to get the best of me and I get that error in my program. Here is the code #include <stdio.h> #include <stdlib.h> #include <string.h> #define REPORTHEADING1 " Employee Pay Hours Gross Tax Net\n" #define REPORTHEADING2 " Name ... (1 Reply)
Discussion started by: Plum
1 Replies
JudySL_funcs(3X)														  JudySL_funcs(3X)

NAME
JudySL functions - C library for creating and accessing a dynamic array, using a null-terminated string as an index (associative array) SYNOPSIS
PPvoid_t JudySLIns( PPvoid_t PPJSLArray, const char * Index, PJError_t PJError); int JudySLDel( PPvoid_t PPJSLArray, const char * Index, PJError_t PJError); PPvoid_t JudySLGet( Pcvoid_t PJSLArray, const char * Index, PJError_t PJError); Word_t JudySLFreeArray(PPvoid_t PPJSLArray, PJError_t PJError); PPvoid_t JudySLFirst( Pcvoid_t PJSLArray, char * Index, PJError_t PJError); PPvoid_t JudySLNext( Pcvoid_t PJSLArray, char * Index, PJError_t PJError); PPvoid_t JudySLLast( Pcvoid_t PJSLArray, char * Index, PJError_t PJError); PPvoid_t JudySLPrev( Pcvoid_t PJSLArray, char * Index, PJError_t PJError); DESCRIPTION
A macro equivalent exists for each function call. Because the macro forms are faster and have a simpler error handling interface than the equivalent functions, they are the preferred way of calling the JudySL functions. See JudySL(3X) for more information. The function call definitions are included here for completeness. One of the difficulties in using the JudySL function calls lies in determining whether to pass a pointer or the address of a pointer. Since the functions that modify the JudySL array must also modify the pointer to the JudySL array, you must pass the address of the pointer rather than the pointer itself. This often leads to hard-to-debug programmatic errors. In practice, the macros allow the compiler to catch programming errors when pointers instead of addresses of pointers are passed. The JudySL function calls have an additional parameter beyond those specified in the macro calls. This parameter is either a pointer to an error structure, or NULL (in which case the detailed error information is not returned). In the following descriptions, the functions are described in terms of how the macros use them (only in the case of #define JUDYER- ROR_NOTEST 1). This is the suggested use of the macros after your program has been fully debugged. When the JUDYERROR_NOTEST macro is not specified, an error structure is declared to store error information returned from the JudySL functions when an error occurs. Notice the placement of the & in the different functions. #define JSLI(PValue, PJSLArray, Index) PValue = JudyLIns(&PJSLArray, Index, PJE0) #define JSLD(Rc_int, PJSLArray, Index) Rc_int = JudySLDel(&PJSLArray, Index, PJE0) #define JSLG(PValue, PJSLArray, Index) PValue = JudySLIns(PJSLArray, Index, PJE0) #define JSLFA(Rc_word, PJSLArray) Rc_word = JudySLFreeArray(&PJSLArray, PJE0) #define JSLF(PValue, PJSLArray, Index) PValue = JudySLFirst(PJSLArray, Index, PJE0) #define JSLN(PValue, PJSLArray, Index) PValue = JudySLNext(PJSLArray, Index, PJE0) #define JSLL(PValue, PJSLArray, Index) PValue = JudySLLast(PJSLArray, Index, PJE0) #define JSLP(PValue, PJSLArray, Index) PValue = JudySLPrev(PJSLArray, Index, PJE0) Definitions for all the Judy functions, the types Pvoid_t, Pcvoid_t, PPvoid_t, Word_t , JError_t, and PJError_t, the constants NULL, JU_ERRNO_*, JERR, PPJERR, and PJE0 are provided in the Judy.h header file (/usr/include/Judy.h). Note: Callers should define JudySL arrays as type Pvoid_t, which can be passed by value to functions that take Pcvoid_t (constant Pvoid_t), and also by address to functions that take PPvoid_t. The return type from most JudySL functions is PPvoid_t so that the values stored in the array can be pointers to other objects, which is a typical usage, or cast to a Word_t * when a pointer to a value is required instead of a pointer to a pointer. AUTHOR
Judy was invented and implemented by Hewlett-Packard. SEE ALSO
Judy(3X), Judy1(3X), Judy1_funcs(3X), JudyL(3X), JudyL_funcs(3X), JudySL(3X), malloc(3), the Judy website, http://www.hp.com/go/judy/, for more information and Application Notes. JudySL_funcs(3X)
All times are GMT -4. The time now is 05:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy