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. C / C++ / MFC
  4. Read/write file help

Read/write file help

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
2 Posts 2 Posters 0 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.
  • E Offline
    E Offline
    eric_tran
    wrote on last edited by
    #1

    Gday everyone, Please help me. How to read and write a pointer of character to a file in C? Thanks in advance. Eric

    eric

    J 1 Reply Last reply
    0
    • E eric_tran

      Gday everyone, Please help me. How to read and write a pointer of character to a file in C? Thanks in advance. Eric

      eric

      J Offline
      J Offline
      Jorgen Sigvardsson
      wrote on last edited by
      #2

      You don't write the pointer to a file. You write the data which the pointer points to.

      char* string = ...;
      FILE* pStream = fopen("file", "w");
      fwrite(string, 1, strlen(string), pStream);

      -- Mit viel Oktan und frei von Blei, eine Kraftstoff wie Benziiiiiiin!

      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