| | |
struct and file processing in C
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Nov 2008
Posts: 4
Reputation:
Solved Threads: 0
hi,can someone please tell me how i can read in data,save data to a file and print it out to the screen using the "gets" statement.My code starts something like:
THANKS
c Syntax (Toggle Plain Text)
#include <stdio.h>; #include <stdlib.h>; struct { char make[10]; char model[10]; double cost; int yearMade; }cars; int main () { FILE *myCars; char cars[200]; myCars = fopen......... .......................
Last edited by Narue; Nov 21st, 2008 at 4:43 pm. Reason: added code tags
>well i aint got any c books
I would have more sympathy for you if the internet weren't a wealth of information. Yet you've bypassed all of the tutorials, references, and ebooks that are available, and gone with the worst possible first step: bothering other people with an easily researched question. Here, let me google that for you since you've already bothered me.
>what can i use then then
fgets. While you're googling, why not look up why gets is unsafe.
>as my tutor was recommending the "gets" statement?
And get a new tutor. Your current one is just clueless enough to ruin your future as a C programmer.
I would have more sympathy for you if the internet weren't a wealth of information. Yet you've bypassed all of the tutorials, references, and ebooks that are available, and gone with the worst possible first step: bothering other people with an easily researched question. Here, let me google that for you since you've already bothered me.
>what can i use then then
fgets. While you're googling, why not look up why gets is unsafe.
>as my tutor was recommending the "gets" statement?
And get a new tutor. Your current one is just clueless enough to ruin your future as a C programmer.
New members chased away this month: 3
Here, let me help you with the
Click Here.
And I'm sure it's inevitable, he's going to do the same with
Click Here too.
gets()/fgets() question:Click Here.
And I'm sure it's inevitable, he's going to do the same with
scanf() , too, so:Click Here too.
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
![]() |
Similar Threads
- comparing file in c (C)
- linked list and file (C)
- File open globally and write to it (C++)
- need help with struct (C)
- Why Data Structures???...QUESTIONS INSIDE (C++)
- help! I don't know what's wrong with my simple code (C)
- Two Build Errors involving my code. (C++)
- MS Visual++ 6.0 - Error C2146, C2501 ... (C++)
- Please Check The Errors'..Dont know what else to do (C++)
- C++ Relcat/Attrcat catalog help (C++)
Other Threads in the C Forum
- Previous Thread: Macro Guard Problem
- Next Thread: image processing in c plzz very imp need urgent help !!!
| Thread Tools | Search this Thread |
Tag cloud for C
* adobe api append array arrays bash binarysearch changingto char character cm copyanyfile copypdffile createcopyoffile createprocess() csyntax directory dynamic execv feet fgets file floatingpointvalidation fork frequency function getlogicaldrivestrin givemetehcodez global gtkgcurlcompiling gtkwinlinux highest histogram homework i/o ide include infiniteloop initialization input interest intmain() iso keyboard kilometer lazy license linked linkedlist linux list lowest matrix meter microsoft mqqueue multi mysql oddnumber odf open openwebfoundation overwrite pause pdf pointer pointers posix power program programming pyramidusingturboccodes read recursion recv recvblocked repetition reversing scheduling segmentationfault send single socketprogramming spoonfeeding stack standard strchr string suggestions system test testautomation unix urboc user whythiscodecausesegmentationfault win32api windows.h windowsapi







.what can i use then then as my tutor was recommending the "gets" statement?