Sponsored Content
Top Forums Programming How can I know where the segment of memory is all Zero? Post 302378859 by jim mcnamara on Wednesday 9th of December 2009 03:37:18 AM
Old 12-09-2009
Code:
size_t is_all_zero( void *location, size_t len)
{
     unsigned char *p=(unsigned char *)location;
     while( len && ! *p)
      {
          p++;
          len--;
      }
      return len; 
}

returns zero when len bytes at location are all zero.
 

9 More Discussions You Might Find Interesting

1. Programming

Segment Fault

When run it, segment fault. What is wrong? #include <stdio.h> #include <stdlib.h> const int max =20; //**************************************************** // Input Matrix //**************************************************** void inMatrixAA(int *AA, int row, int col)... (9 Replies)
Discussion started by: zhshqzyc
9 Replies

2. IP Networking

Network Access on Different Segment

I do have 2 different segment network which different platform on each segment. E.g. 20 segment, Windows OS can talk to Unix OS and 21 segment practice same rule. Further more, Windows OS from 20 segment can talk to 21 segment other OS but only the UNIX OS in 20 segment fail to talk to 21 segment.... (3 Replies)
Discussion started by: HASM
3 Replies

3. Shell Programming and Scripting

extract segment

Hey all, could someone please direct me on how to extract a segment from a file between two tags? Thanks! (1 Reply)
Discussion started by: mpang_
1 Replies

4. HP-UX

WAS 6.1 ND/Lawson ERP/HP-UX 11.23 PA-RISC - unable to attach shared memory segment

I'm not an HP-UX Admin professional, but rather a Lawson ERP installer. I'm looking for clues on how to troubleshoot this issue. I have WAS 6.1 ND running on HP-UX 11.23 PA-RISC with the Lawson ERP application . When I start the Lawson application, no errors arise. When I start WAS app server, an... (4 Replies)
Discussion started by: mrvitas
4 Replies

5. Shell Programming and Scripting

Cutting segment of a string

Hi, I am using bash. My question concerns cutting out segments of a string. Given the following filename: S2002254132542.L1A_MLAC.x.hdf I have been able to successfully separate the string at the periods (.): $ L1A_FILE=S2002254132542.L1A_MLAC.x.hdf $ BASE=$(echo $L1A_FILE | awk -F.... (5 Replies)
Discussion started by: msb65
5 Replies

6. UNIX for Dummies Questions & Answers

code segment

how do i close a do code segment? od? (1 Reply)
Discussion started by: trob
1 Replies

7. Programming

Segment Violation

Hi to all. I'm reciving a "Segment violation" error from this code and I don't know why. void insertAtEnd(NodeType *pList) { char element; printf("Introduce a element: \n"); setbuf(stdin, NULL); scanf("%c", &element); //Find the end of the list; while... (4 Replies)
Discussion started by: daniel.gbaena
4 Replies

8. Programming

Data segment or Text segment

Hi, Whether the following piece of code is placed in the read-only memory of code (text) segment or data segment? char *a = "Hello"; I am getting two different answers while searching in google :( that's why the confusion is (7 Replies)
Discussion started by: royalibrahim
7 Replies

9. Programming

why segment fault,

I always get segment fault, why? can sb help me and modify it, I have spend on much time on #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <sys/time.h> #include <string.h> #define MAX 10 pthread_t thread; void *thread1() { int *a; int i, n; ... (1 Reply)
Discussion started by: yanglei_fage
1 Replies
MEMCHR(3)						   BSD Library Functions Manual 						 MEMCHR(3)

NAME
memchr, memrchr -- locate byte in byte string LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <string.h> void * memchr(const void *b, int c, size_t len); void * memrchr(const void *b, int c, size_t len); DESCRIPTION
The memchr() function locates the first occurrence of c (converted to an unsigned char) in string b. The memrchr() function locates the last occurrence of c (converted to an unsigned char) in string b. RETURN VALUES
The memchr() and memrchr() functions return a pointer to the byte located, or NULL if no such byte exists within len bytes. SEE ALSO
index(3), rindex(3), strchr(3), strcspn(3), strpbrk(3), strrchr(3), strsep(3), strspn(3), strstr(3), strtok(3) STANDARDS
The memchr() function conforms to ANSI X3.159-1989 (``ANSI C89''). BSD
April 10, 2009 BSD
All times are GMT -4. The time now is 09:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy