LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


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

Rep: Reputation: 15
C File reading and writing


hi

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
pycoucou
Member
 
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.

PY
 
Old 05-03-2005, 10:58 AM   #3
Dave Kelly
Member
 
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
introuble
Member
 
Registered: Apr 2004
Distribution: Debian -unstable
Posts: 700

Rep: Reputation: 31
malloc()
 
  


Reply



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
vb.net 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

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:20 AM.

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