OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [objc.dg/] [type-stream-1.m] - Rev 823

Go to most recent revision | Compare with Previous | Blame | View Log

/* { dg-options "-fgnu-runtime" } */
/* { dg-do run } */
#include <objc/typedstream.h>
#include <stdio.h>
#include <stdlib.h>
 
int main (void)
{
  FILE *f; TypedStream *ts;
  struct T { int a, b; } x = { 1, 2 };
  f = fopen ("foo", "w"); ts = objc_open_typed_stream (f, OBJC_WRITEONLY);
  objc_write_type (ts, @encode(struct T), &x);
  objc_close_typed_stream (ts); fclose (f);
  f = fopen ("foo", "r"); ts = objc_open_typed_stream (f, OBJC_READONLY);
  struct T y;
  objc_read_type (ts, @encode(struct T), &y);
  if (y.a != 1)
   abort ();
  if (y.b != 2)
   abort ();
  objc_close_typed_stream (ts); fclose (f);
  remove ("foo");
  return 0;
}
 
 

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.