Sponsored Content
Full Discussion: C bzero() to memset() issue
Top Forums Programming C bzero() to memset() issue Post 302388630 by Jess83 on Thursday 21st of January 2010 05:21:19 AM
Old 01-21-2010
Sorry I should of been clearer, I "currently" running the codes on a gentoo machine... I wanted to translate the bzero() bcopy() before attempting to port it to windows. Now I am on a Gentoo machine and with bzero/bcopy instead of memset it works fine... whenever i switch bzero(buffer, 256); to memset(buffer, '\0' , 256); SMTP server replies "Error: Unrecognized command" for all commands sent to the SMTP with memset() replacing bzero()

---------- Post updated at 06:21 AM ---------- Previous update was at 04:41 AM ----------

God... I can't believe I did that read the man too fast i guess... lol I fixed it it wasn't in

Code:
bzero(buffer, 256)

issue came from a little higher up with

Code:
 bcopy((char *)server->h_addr, 
         (char *)&serv_addr.sin_addr.s_addr,
         server->h_length);


has just changed bcopy for memcpy not knowing the way it copied bits from which location to where... fixed it by

Code:
memcpy((char *)&serv_addr.sin_addr.s_addr, 
         (char *)server->h_addr,
         server->h_length);

 

10 More Discussions You Might Find Interesting

1. Programming

bzero in socket

Sirs, I am new to socket programming.I have to do bzero and bcopy in my programs what is the use of it. It will be very usefull for me to know it. thanks, arunkumar (1 Reply)
Discussion started by: arunkumar_mca
1 Replies

2. Programming

about memset fuction

Dear all, In my code,i am planning to use memset function to re-initialise an array before populating it everytime. Will using memset function be an overload to the program? (3 Replies)
Discussion started by: ranj@chn
3 Replies

3. UNIX for Dummies Questions & Answers

questions in memset

HI all , please find the piece of code below char *t; char *f; char buf; memset(buf,0,50); after that i am assigning memory for (i=0; i<100; i++) { t = buf+(i*6); f = "ARUN"; } my question .. 1) i have run this it is... (7 Replies)
Discussion started by: arunkumar_mca
7 Replies

4. Shell Programming and Scripting

Unix Arithmatic operation issue , datatype issue

Hi, I have a shell scripting. This will take 7 digit number in each line and add 7 digit number with next subsequent lines ( normal addition ). Eg: 0000001 0000220 0001235 0000022 0000023 ........... ......... ........ Like this i am having around 1500000 records. After adding... (23 Replies)
Discussion started by: thambi
23 Replies

5. UNIX for Advanced & Expert Users

memset vs calloc

Dear Friends, Can any one tell me the difference between memset and calloc function in C. Regards, Selvi (7 Replies)
Discussion started by: salvi
7 Replies

6. Solaris

application Crashes on memset ?? any suggestions

Hi All, we have an application that is written in 'C' programming to connects to various servers in the organization. The bellow code establish a TCP connection to connect to the remote servers. the application works perfectly ok, but, after some time the entire process get's crashed and... (2 Replies)
Discussion started by: sudharma
2 Replies

7. UNIX for Dummies Questions & Answers

ISSUE and ISSUE.NET files

In LINUX(CentOS, RedHat) is there a way to have the banner statement appear before the logon instead of after the logon? In UNIX and Windows the banner appears before a person actually logs on, what I'm seeing in LINUX is that it appears after the login(ftp, telnet, SSH). Thanks (0 Replies)
Discussion started by: ejjones
0 Replies

8. Shell Programming and Scripting

Need assistance with a file issue and a terminal issue

Hello everyone, I'm in need of some assistance. I'm currently enrolled in an introductory UNIX shell programming course and, well halfway through the semester, we are receiving our first actual assignment. I've somewhat realized now that I've fallen behind, and I'm working to get caught up, but for... (1 Reply)
Discussion started by: MrMagoo22
1 Replies

9. Shell Programming and Scripting

Variable value substitution issue with awk command issue

Hi All, I am using the below script which has awk command, but it is not returing the expected result. can some pls help me to correct the command. The below script sample.ksh should give the result if the value of last 4 digits in the variable NM matches with the variable value DAT. The... (7 Replies)
Discussion started by: G.K.K
7 Replies

10. Emergency UNIX and Linux Support

Memset fails on Solaris

Hi, memset call is failing on solaris for me. I wrote below code and that also fails. Any hints? void *memset(void *dst, int c, size_t n) { if (n) { char *d = dst; do { *d++ = c; } while (--n); } return dst; } (2 Replies)
Discussion started by: skyineyes
2 Replies
BSTRING(3)						   BSD Library Functions Manual 						BSTRING(3)

NAME
bcmp, bcopy, bzero, memccpy, memchr, memcmp, memcpy, memmove, memset -- byte string operations LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <strings.h> int bcmp(const void *s1, const void *s2, size_t n); void bcopy(const void *s1, void *s2, size_t n); void bzero(void *s, size_t n); #include <string.h> void * memccpy(void *restrict s1, const void *restrict s2, int c, size_t n); void * memchr(const void *s, int c, size_t n); int memcmp(const void *s1, const void *s2, size_t n); void * memcpy(void *restrict s1, const void *restrict s2, size_t n); void * memmove(void *s1, const void *s2, size_t n); void * memset(void *s, int c, size_t n); DESCRIPTION
These functions operate on variable length strings of bytes. They do not check for terminating null bytes, as the routines listed in string(3) do. See the specific manual pages for more information. LEGACY SYNOPSIS
#include <string.h> The include file <string.h> is necessary and sufficient for all functions. SEE ALSO
bcmp(3), bcopy(3), bzero(3), memccpy(3), memchr(3), memcmp(3), memcpy(3), memmove(3), memset(3), compat(5) STANDARDS
The functions memchr(), memcmp(), memcpy(), memmove(), and memset() conform to ISO/IEC 9899:1990 (``ISO C90''). HISTORY
The functions bzero() and memccpy() appeared in 4.3BSD; the functions bcmp(), bcopy(), appeared in 4.2BSD. BSD
June 4, 1993 BSD
All times are GMT -4. The time now is 10:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy