LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 09-16-2005, 04:48 PM   #1
alaios
Senior Member
 
Registered: Jan 2003
Location: Aachen
Distribution: Opensuse 11.2 (nice and steady)
Posts: 2,133

Rep: Reputation: 45
memcpy problems


HELP
Code:
 memcpy(&send_qdisc_stats,&log_qdisc_stats,sizeof(log_qdisc_stats));
                printf("Prin tin allagi sto reconfigure prin to set %s \n",log_qdisc_stats[0].htbstats.rate);
                printf("Prin tin allagi sto reconfigure prin to set %s \n",log_qdisc_stats[0].htbstats.ceil);



                printf("Prin tin allagi sto reconfigure prin to set %s \n",send_qdisc_stats[0].htbstats.rate);
                printf("Prin tin allagi sto reconfigure prin to set %s \n",send_qdisc_stats[0].htbstats.ceil);
This programme at execution prints the following...HELP memcpy dont work.... and dont know how to use it

Prin tin allagi sto reconfigure prin to set 100Kbit
Prin tin allagi sto reconfigure prin to set 100Kbit
Prin tin allagi sto reconfigure prin to set
Prin tin allagi sto reconfigure prin to set
 
Old 09-16-2005, 04:53 PM   #2
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 58
Thanks for supplying so much relevant information such as the definitions for send_qdisc_stats and log_qdisc_stats. It makes helping you so much easier. After 1264 posts one would think you'd know that.
 
Old 09-16-2005, 04:57 PM   #3
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 58
Anyway, here's an example of how to properly use memcpy():
Code:
#include <stdio.h>
#include <string.h>

int main(void)
{
  struct foo { int a; int b; };
  struct foo one = { 10, 20 };
  struct foo two;

  memcpy(&two, &one, sizeof(one));

  printf("two.a = %d, two.b = %d\n", two.a, two.b);

  return 0;
}
The output is:
two.a = 10, two.b = 20
 
Old 09-17-2005, 03:31 AM   #4
alaios
Senior Member
 
Registered: Jan 2003
Location: Aachen
Distribution: Opensuse 11.2 (nice and steady)
Posts: 2,133

Original Poster
Rep: Reputation: 45
extern union qdisc log_qdisc_stats[10];
union qdisc send_qdisc_stats[10];



struct htb{
char prio[maxlength];
char rate[maxlength];
char ceil[maxlength];
char burst[maxlength];
char cbusrt[maxlength];
};

struct cbq{
char allot[maxlength];
char avpkt[maxlength];
char bandwidth[maxlength];
char rate[maxlength];
char mpu[maxlength];
char bytes[maxlength];
};

struct tbf{
char burst[maxlength];
char mpu[maxlength];
char rate[maxlength];
char peakrate[maxlength];
};



union qdisc{
struct htb htbstats;
struct cbq cbqstats;
struct tbf tbfstats;
};
 
Old 09-17-2005, 08:26 AM   #5
addy86
Member
 
Registered: Nov 2004
Location: Germany
Distribution: Debian Testing
Posts: 332

Rep: Reputation: 31
Is the code in your original post the exact code or is there something in between?
Have you tried debugging with gdb?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i speed up memcpy? Thinking Programming 9 10-14-2005 08:53 AM
Need help: Seg fault, Memcpy, and dynamically allocated arrays benobi Programming 3 06-09-2005 11:58 PM
cisco 350 wireless problems and suse x-server problems incognito9 Linux - Wireless Networking 5 10-14-2004 08:53 AM
Problems, problems, problems. Lets start with the soundcard Kre8ive Linux - Newbie 5 08-07-2003 02:20 AM
Problems, problems, problems. Lets start with the ES 1868 AudioDrive Kre8ive Linux - Newbie 1 08-06-2003 08:04 PM


All times are GMT -5. The time now is 04:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration