salut

j'ai un problème avec le passage par valeur des struct :
voici un simple code avec lequel j'essaye de trouver solution à mon problème:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "stdafx.h"
#include "stdio.h"
#include <string.h>
 struct BS
	  {
	  int   DRlen;   // the length of Boundary Scan Register
      int   PINnum;  // the number of devices pins
	  int   IRlen;   // the length of Instruction Register
      char* Name;    // the name of JTAG-device
	  char* ID;      // device ID Code
      char* File;    // file name with device description
 
      };
void init_BS(struct BS*  BSbegin)
{
	char s[10];
	strcpy(s,"hello");
	BSbegin->Name=s;
   BSbegin->IRlen=12;
}
 
int _tmain(int argc, _TCHAR* argv[])
{
  struct BS BSbegin; 
  init_BS(&BSbegin);
 
  printf("irlen:%d\n",BSbegin.IRlen);
 printf("name:%s\n",BSbegin.Name);
	return 0;
}
mon problème c que l'affichage de irlen ce fait parfaitement mais le name ne s'affiche pas correctement

s'il vous plait heeeeeeeeeelp