Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 05-03-2005, 07:31 AM   #1
LQ Newbie
Registered: Apr 2005
Location: India
Posts: 22

Rep: Reputation: 15
C File reading and writing


I was writing an application where i need to write text to a file whose size is determined at runtime.

I am familiar with this

struct book
int num;
char msg[FIXED_SIZE];

Then performing fread and fwrite.
But what i require is char *msg rather than msg[FIXED_SIZE].

Could anyone give me some reference or a snippet of how to do this.

Thank You
Abhishek Samuel
Old 05-03-2005, 07:40 AM   #2
Registered: Apr 2004
Location: Edinburgh
Posts: 78

Rep: Reputation: 15
I don't get exactly your point

your two variables message are equivalent: msg[0]=*msg

Sorry for this poor help, but I'm not fully acquainted with de details of fwrite but I guess that typecasting would be sufficient.

Old 05-03-2005, 10:58 AM   #3
Dave Kelly
Registered: Aug 2004
Location: Todd Mission Texas
Distribution: Linspire
Posts: 215

Rep: Reputation: 31
Question: Class assignment.
Library Card Program?
Old 05-03-2005, 03:59 PM   #4
Registered: Apr 2004
Distribution: Debian -unstable
Posts: 700

Rep: Reputation: 31


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
BASH script Ė reading and writing variables to a separate file morrolan Programming 10 09-20-2005 07:45 AM reading and writing to a text file simultaneously mrobertson Programming 3 09-08-2005 12:30 PM
Help reading and writing to file xiste Programming 1 04-15-2005 12:43 AM
Reading and Writing DVD media elsabio Fedora 2 03-06-2005 06:25 PM
reading / writing OpenOffice files. G™utama Programming 1 11-04-2003 06:46 AM

All times are GMT -5. The time now is 07:34 PM.

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