How come '\0' doesnt show up in the debugger?


 
Thread Tools Search this Thread
Top Forums Programming How come '\0' doesnt show up in the debugger?
# 8  
Old 06-21-2007
Quote:
Originally Posted by porter
What is len for if you are then doing a strlen?

I still haven't worked out why you are assigning to strarr when it was given to you as an argument?

Do you actually mean

Code:
strarr[0]=malloc(strlen(line)+1);

then you should be doing

Code:
strcpy(strarr[0],line);


I wasn't too sure what I was doing either. I was just trying to get it to work at the time. Anyhow, I thought about it and I think using strcpy() is the correct approach.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

Doesnt allow me to use [CODE] tags

Just got penalised for not performing a feature that didnt work for me. I tried to edit the post twice to add code tags, both manually and via button did not work. code - manual code - button (7 Replies)
Discussion started by: 06s23
7 Replies

2. UNIX for Dummies Questions & Answers

why doesnt it work?

I am trying to print out two fields in a file using awk. So, I have got awk -F '\t' 'NF = 2 {print $1 $2 "]"}' two.txt in a script called what.awk When i run this version like this - ./what.awk then it runs however I want to run the program like this awk -f what.awk two.txt. When I... (8 Replies)
Discussion started by: The undertaker
8 Replies

3. AIX

Vi doesnt work

Hi Guys, I have a strange problem.( AIX 6.1) "vi" is not working at all..Whenever i #vi <anythin> ,, it returns the prompt back. Any clues folks?? (14 Replies)
Discussion started by: muzahed
14 Replies

4. Programming

Alternative debugger to GNU insight debugger

GNU insight debugger is not available now a days and it is required to debug/inspect assembly code as written in the book Assembly Language Programming step by step in Linux so my question is; is there any alternative to insight that I can use instead of insight in which I can get the same... (5 Replies)
Discussion started by: vectrum
5 Replies

5. Shell Programming and Scripting

compiler doesnt work

this is my file I have written. // My first C++ program #include <iostream> int main() { std::cout << "Hi there!" << std::endl"; std::cout << "This is my first C++ program" << std::endl"; return(0); } This is the error I get, why? $ g++ first.cpp ksh: g++: not found (1 Reply)
Discussion started by: gustave
1 Replies

6. Shell Programming and Scripting

loop doesnt work

It just does the break...even though the files are not the same... # Compare extracts #========================================== count=0 while (( count < 5 )) do (( count+=1 )) echo "Try $count" file1=$(ls -l /tmp/psjava.xml|... (5 Replies)
Discussion started by: sigh2010
5 Replies

7. Red Hat

ldapsearch doesnt work.

Hii All, I am using openldap v2.3 on redhat El-4. When i run ldapsearch it returns all the entries. The command runs successfully. But when I run the ldapsearch with following filter option it doesnt work and immediately returns to the shell. ldapsearch uidNumber>=2000 I've started slapd... (0 Replies)
Discussion started by: shamik
0 Replies

8. UNIX for Dummies Questions & Answers

cp doesnt work - Help

When trying to copy a file in Solaris 8 it doesnt copy file or give a error. This worked 100% until the 29th. I've checked the rights and everything seems fine: drwxrwxrwx 2 bmuser bmgroup 11776 Jan 3 10:32 spool This is the file I want to copy: -rwxrwxrwx 1 bmuser bmgroup ... (26 Replies)
Discussion started by: rudi.okelly
26 Replies

9. Programming

why doesnt this compile correctly

hello there when i try and compile i keep getting this error that 'error C2115: 'function' : incompatible types' on the following line of the code: for (i = 0; i < nCommands; ++i) { printf(" Command: \n", i); printComStruct(com); // HERE } the following is my printComStruct... (0 Replies)
Discussion started by: mile1982
0 Replies

10. UNIX for Dummies Questions & Answers

cd.. doesnt work

hi when i want to go to previous directory by typing cd.. i get the following message $ cd.. ksh: cd..: not found Please help rintingtong (2 Replies)
Discussion started by: rintingtong
2 Replies
Login or Register to Ask a Question
strlen(3)						     Library Functions Manual							 strlen(3)

NAME
strlen - Finds the length of a string LIBRARY
Standard C Library (libc.so, libc.a) SYNOPSIS
#include <string.h> size_t strlen( const char *s); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: strlen(): ISO C, XPG4 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the string. DESCRIPTION
The strlen() function returns the number of bytes in the string pointed to by the s parameter. The string length value does not include the terminating null character. Note If you pass a NULL pointer as the const char * parameter to the strlen function, the function generates a segmentation violation. To avoid the segmentation violation and cause the function to return 0 (zero), change the NULL pointer treatment for the process before issuing the call to the strlen function, as follows: Include the system header file sys/uswitch.h. Call the uswitch function, as described in the uswitch(2) reference page. The following program illustrates this procedure: #include <stdio.h> #include <sys/types.h> #include <sys/uswitch.h> main() { size_t retval; int uswitch_val; uswitch_val = uswitch(USC_GET,0); uswitch(USC_SET, uswitch_val | USW_NULLP); retval = strlen(NULL); RETURN VALUES
On successful completion, the strlen() function returns the number of characters (bytes) in the string to which the s parameter points. Current industry standards specify that no value be reserved to indicate an error. RELATED INFORMATION
Functions: string(3), uswitch(2), wcslen(3) Standards: standards(5) delim off strlen(3)