Sponsored Content
Top Forums Programming Free() - Program getting aborted. Post 302892124 by ahamed101 on Tuesday 11th of March 2014 05:51:51 AM
Old 03-11-2014
char initialization like what you did back there can only be done along with delcaration.
Code:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

void print_by_ptr(char **str) {
    printf("<%s>\n",*str);
    printf("Now I am modifying the str.\n");
    strcpy(*str, "Hello there is modified by the function");
    printf("Printing inside the function\n");
    printf("<%s>\n",*str);
}

int main() {
    char *mystr = malloc(100 * sizeof(char));
    strcpy(mystr, "Hello There!!");
    print_by_ptr(&mystr);
    printf("Printing in main()\n");
    printf("<%s>\n",mystr);
    //mystr = NULL;
    free(mystr);
    printf("Now exit\n");
    return 0;
}

 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

BEGIN failed--compilation aborted

i m trying to run a command from diffrent login ,where i get following messages Empty compile time value given to use lib at /svm_wl1/billing/atai/rel/server/util/ataprocs line 73 Empty compile time value given to use lib at /svm_wl1/billing/atai/rel/server/util/ataprocs line 73 Empty... (1 Reply)
Discussion started by: abhijeetkul
1 Replies

2. Programming

Program received signal SIGABRT, Aborted.

I ran degugger in C++ and the followings are the message I got: Program received signal SIGABRT, Aborted. 0x002a57a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2 (gdb) info s #0 0x002a57a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2 #1 0x002e97f5 in raise () from /lib/tls/libc.so.6... (1 Reply)
Discussion started by: napapanbkk
1 Replies

3. Shell Programming and Scripting

aborted due to compilation error

I wanted to edit the time for a cron job that cleans out the quarantine in mailscanner. etc/cron.daily/clean.quarantine I edited the file #!/usr/bin/perl # # IMPORTANT NOTE: # # Change the next line to 0 instead of 1 to enable this script. # By default it will be disabled and... (2 Replies)
Discussion started by: mcraul
2 Replies

4. Programming

How to get free disk space size in C/C++ program( Solaris system)

How to get free disk space size in C/C++ program( Solaris system)? Is there any standard function or system function? Just like "df" or "getdfree" in Linux. (4 Replies)
Discussion started by: yidu
4 Replies

5. Cybersecurity

cvs [login aborted]

Hi, I installed CVSNT on PC and trying to checkout files from/on linux box. Logging in to :pserver:user1@16.145.134.210:22/DBMONITOR/CVSROOT CVS password: cvs : unrecognized auth response from 16.145.134.210: SSH-2.0-OpenSSH_5.4 ssh is ok. $ ssh user1@16.145.134.210... (1 Reply)
Discussion started by: zam
1 Replies

6. AIX

HPOV : coda is aborted

the service coda is aborted in HPOV the OS is AIX 6.1 , i reinstall it but its give me the same message , i remove coda files under /var/opt/OV/datafiles and i restart the service but its aborted agine . ./ovc -status ovcd OV Control CORE (44302556) Running agtrep OV Discovery Agent... (8 Replies)
Discussion started by: thecobra151
8 Replies

7. Programming

Why do I receive Program received signal SIGABRT, Aborted?

Im using gdb and when a user disconnects from my server I receive a message Program received signal SIGABRT, Aborted. 0x7ffe0304 in ?? () I was hoping someone here might have a explination for this message in gdb (26 Replies)
Discussion started by: Errigour
26 Replies

8. Solaris

backup aborted

hi all I am getting following error while taking backup using the command ufsdump 0ubf 512 /dev/rmt/0cbn /database/backup2/rman_backup/level0 >> /database/backup2/backup_tape/level0_rman_06sep12 2>&1; from the log i got the error bash# tail -f level0_rman_06sep12 DUMP: Date of... (3 Replies)
Discussion started by: nikhil kasar
3 Replies

9. UNIX and Linux Applications

Need a FTP SERVER Program FREE

I need a FTP SERVER program for using in ubuntu, Do you know any for free? ps: there will be no internet connection so, vsftp will not work. need a tool (like filezilla but filezilla has no server version for unix ubuntu) that has to be installation package to extract in it. (6 Replies)
Discussion started by: F@NTOM
6 Replies
XPRINTF_EXEC(3) 					   BSD Library Functions Manual 					   XPRINTF_EXEC(3)

NAME
asxprintf_exec, dxprintf_exec, fxprintf_exec, sxprintf_exec, xprintf_exec, vasxprintf_exec, vdxprintf_exec, vfxprintf_exec, vsxprintf_exec, vxprintf_exec -- execute-only extensible printf execution SYNOPSIS
#include <printf.h> int asxprintf_exec(char ** restrict ret, printf_comp_t restrict pc, ...); int dxprintf_exec(int fd, printf_comp_t restrict pc, ...); int fxprintf_exec(FILE * restrict stream, printf_comp_t restrict pc, ...); int sxprintf_exec(char * restrict str, size_t size, printf_comp_t restrict pc, ...); int xprintf_exec(printf_comp_t restrict pc, ...); #include <stdarg.h> int vasxprintf_exec(char ** restrict ret, printf_comp_t restrict pc, va_list ap); int vdxprintf_exec(int fd, printf_comp_t restrict pc, va_list ap); int vfxprintf_exec(FILE * restrict stream, printf_comp_t restrict pc, va_list ap); int vsxprintf_exec(char * restrict str, size_t size, printf_comp_t restrict pc, va_list ap); int vxprintf_exec(printf_comp_t restrict pc, va_list ap); DESCRIPTION
These functions are execute-only, extensible printf (see xprintf(5)) variants, taking a printf_comp_t structure created by the format string compilation routine new_printf_comp(3). All these variants behave like their normal printf counterparts (see printf(3)) without 'x' and ``_exec'' in the name (except sxprintf_exec() and vsxprintf_exec() behave like snprintf() and vsnprintf(), respectively). SEE ALSO
printf(3), xprintf_comp(3), xprintf(5) Darwin Aug 19, 2012 Darwin
All times are GMT -4. The time now is 05:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy