Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. defining a pointer to a file so that its info won't get lost!!

defining a pointer to a file so that its info won't get lost!!

Scheduled Pinned Locked Moved Managed C++/CLI
questioncomhelplounge
1 Posts 1 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shanika
    wrote on last edited by
    #1

    I have a general question. I am using fread(...) fn in my program. I created a FILE *inFile to point to the file that i opened for read. (ie. inFile = fopen("c:\\document.bnm","r")) I am reading 20 ascii characters at a time from the file and then send them out thru the serial port ,....i keep doing this until the end of file is reached. My file opening and reading is defined in one class called COpen and my serial communication routines are defines in a class called Tserial_event. Once I call the function from COpen to send data thru the serial port ( com->sendData(), where com is an object of class tserial_event) and the program jumps to where the sendData fn is defined the value of inFile is lost!!!!!!!!! Originally it points to location 0x1027a898, when it jumps to sendData() it becomes 0x0000000??? and then when it returs to the fread statement to raed the next 20 characetrs it crashes, saying that I am raeding at an invalid location obviously because my pointer was lost. My question is how should I define inFile so that it wouldn't change value when I uump to another class. I NEED HELP ASAP IF SOMEONE CAN HELP ME

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups