input « output « C File Q&A

Home
C File Q&A
1.array
2.binary
3.delete
4.Development
5.directory
6.fgets
7.fopen
8.fprintf
9.fscanf
10.fwrite
11.header
12.include
13.input
14.LINE
15.linux
16.open
17.output
18.pointer
19.read
20.size
21.string
22.struct
23.Text
24.windows
25.write
C File Q&A » output » input 

1. C logging input to file?    stackoverflow.com

I'm working on a program that logs input to a file. This is my current code:

#include <stdio.h>
#include <curses.h>
#include <signal.h>
#define WAIT 3
#define INCORRECT "Incorrect input\n"
#define FILENAME ".xintrc"

int stop();

int main()
{
    ...

2. What directory do I have to put my input file for a C program?    stackoverflow.com

I'm using Netbeans to write a C program. Where do I need to paste my input.txt file for the program to read it if I don't want to specify a directory ...

3. C code and input files and output file    bytes.com

P: 1 dwaterpolo Hi Everyone, I am trying to read two text files swY40p10t3ctw45.col.txt and solution.txt and compare them, the first text file has a bunch of values listed like: y[1,1,1,1] y[1,1,1,2] y[1,1,1,3] y[1,1,1,4] y[1,1,1,5] y[1,1,1,6] y[1,1,1,7] y[1,1,1,8] and so on.. and I am trying to compare it with a text file that looks like: C0001 1.0000000 C0215 1.0000000 C0817 1.0000000 ...

4. Problems with file input/output    bytes.com

Many thanks, your first point pointed me in the right direction. I was opening asciivalue.txt using write because if the user chooses -e (to encrypt) then an array of characters is written to that file. If they choose -d (to decrypt) then the characters are read from the file to an array of characters. I was declaring this at the start ...

5. file input/output    bytes.com

Hia, I have to write a program in C to calculate the determinant of a matrix. I have mannaged to write a program which achieves for elements input by a user, however the program must take matrix elements from a file rather than a user. The file is in the form, 3.0 2.0 -4.9 1.2 -4.3 6.1 I have been looking ...

6. Reformat file input/output    bytes.com

I have to write a program that will reformat the data files given to me and create a new data file for each city. The desired output would be the cities name followed by the year( fixed four digits), monthly rainfall-12 months(Jan-Dec), and total rainfall for that year(4 digit). In order to format the year I must drop the first 6 ...

7. handling input and output data in files    bytes.com

Hello, I want to create an input file for my program in which I store all of my input data (constants etc.). Something of this kind: ------------ Input parameters ------------ boxlengthX 1.0 boxlengthY 1.0 boxlengthZ 1.0 radius (nm) 10 Temperature (K) 298 etc. which scan function allows the various functions of the program to go and look for the necessary input ...

8. File input/output    bytes.com

P: n/a John Williams I'm writing a stagenography program to experiment with how it works. The algorithm I'm using appears to be producing the correct result...however I'm struggling with the file input. I never learned file input/output very well (I self taught all the programming I know...and my c++ book was not good) and so I'm not sure what's wrong with ...

9. FILE input output in C    cboard.cprogramming.com

10. Mailing Label Program - Input & Output Files    cboard.cprogramming.com

Hello, You guys have been a great help for a few posts I've made, so I've come back for more sage advice. The following program is not operating as I think it should, so I'm certainly missing some knowledge or have misconceptions about how fprintf and fscanf work. I've even read through the stdio.h section of P.J. Plauger's "The Standard C ...

11. From input to output file creation    cboard.cprogramming.com

12. problem with file input output    cboard.cprogramming.com

The problem with ur code is #define not_vowel(ch) (ch!='A'||ch!='a'||ch!='E'||ch!='e'||ch!='I'||ch!='i'||ch!='O'||ch!='o'||ch!='U'||ch!='u') it should be of #define not_vowel(ch) (ch!='A'&& ch!='a'&& ch!='E'&& ch!='e'&& ch!='I'&& ch!='i'\ && ch!='O'&& ch!='o'&& ch!='U'&& ch!='u')' also with some minor mistakes . For your reference the code is given below ------------------------------------------------------------------------- /* vowel_remover.c */ #include #include #define not_vowel(ch) (ch!='A'&& ch!='a'&& ch!='E'&& ch!='e'&& ch!='I'&& ch!='i'\ && ch!='O'&& ch!='o'&& ch!='U'&& ch!='u') main() ...

13. input/output files    cboard.cprogramming.com

#include #include #include int main (void){ FILE *inputFile; FILE *outputFile; char string[81]; memset(string, 0, 81); int rowNr = 0; inputFile = fopen("test.txt", "r"); outputFile = fopen ("nummering.txt", "w"); while (fgets(string, 80, inputFile) != NULL){ rowNr++; fprintf(outputFile, "%i %s\n", rowNr, string); memset(string, 0, 81); } fclose (outputFile); fclose (inputFile); printf("\n"); return 0; }

14. [C Programming]Problems with file input/output    cboard.cprogramming.com

[C Programming]Problems with file input/output I am working on an assignment(C Programming). Firstly, please have a look at my question and the coding: Problem: 1. How to delete part of the entry from the address book? 2. Problem retreving address as string from file, if my address contain spaces, it will only read the 1st value (eg. Road 32, it will ...

15. file input/output    cboard.cprogramming.com

16. Input/Output Files    cboard.cprogramming.com

I am in need of some guidance for a problem in my CS class. The problem is stated as follows: Rewrite the file backup program in figure 12.1 so it uses a function with file pointer parameters to do the actual file copy. Here is figure 12.1 > Code: Figure 12.1 Program to Make a Backup Copy of a Text File ...

17. Input and Output files    cboard.cprogramming.com

18. Need help splitting input file into multiple output files    cboard.cprogramming.com

Hello to all, I am new to programming and need help with a program. I am trying to split one large file into multiple smaller files. The smaller files have to start from a line that starts with "LOCUS.." and end at a line that starts with "//..." The way the original file is setup, this occurs several times. Also, I ...

19. segmentaion fault with File Input/Output    cboard.cprogramming.com

#include #include #include int main(int argc,char**argv){ char c[10]; /* declare a char array */ FILE *file; /* declare a FILE pointer */ char *filename; printf("Please enter the file name: "); scanf("%s",&filename); char *cc; char *dd=".txt"; cc=strcat(filename, dd); // the file name file = fopen(cc, "r"); /* open a text file for reading */ if(file==NULL) { printf("Error: can't open file.\n"); return ...

20. File input/output question    cboard.cprogramming.com

#include struct players { char name[100]; char position[100]; double points; double steals; double blocks; double rebounds; }; struct players nba[100]; int main() { FILE *ifp, *ofp; char inputFile[100]; char outputFile[100]; int numberPlayers; printf("What is the name of the input file?\n"); scanf("%s", inputFile); printf("What is the name of the output file?\n"); scanf("%s", outputFile); ifp = fopen("players.txt", "r"); fscanf(ifp, "%d", &numberPlayers); fclose(ifp); ...

21. file input/output    cboard.cprogramming.com

22. file input/output    cboard.cprogramming.com

I am suppose to write a program that can save a list of names and its relevant info(into a structure). However, i have problem retrieving the "name" datas out when i open the program again.Here's a summary of what i wrote.PLEASE TAKE NOTE OF LINE A AND LINE B. Code: /* structure declaration */ typedef struct { char marker; char id; ...

23. File I/O with 2 input and 1 output file    cboard.cprogramming.com

Hi all, I am trying to take in 2 input files and an output file in as command line arguments. I am new to this, so bear with me if the code is a little rough. Below is what I have on that. In the command line I am typing in: > a.out lab5_1.txt lab5_2.txt ( I'm not typing the > ...

24. File Input and Output, simple.    cboard.cprogramming.com

void saverecord(void) { FILE *fp; //The file... //Open the file! if((fp = fopen("scores.dat","a")) == NULL) { printf("Error! Cannot open the file!\n"); msleep(1); //Delay... exit(1); //Exit... } //Write #HERE I NEED HELP# fwrite(name, sizeof(name),1,fp); //Now I havent any idea how to make the spaces and to //output the number two... //Close the file fclose(fp); }

25. File input & output (Full coding)    cboard.cprogramming.com

File input & output (Full coding) /* This program is used to input file, search particular record and display all the record. I'm using TcLite to compile. */ /*PROBLEM... 1) The data type i used to search for a particular record is char, everytime i do a searching, it cannot found any record. I try to change the date type to ...

26. file input and output    cboard.cprogramming.com

file input and output /* This program is to input wizard detail into disk, display all the wizard details and search for particular wizard detail using wizardID or name. How to solve my problem as stated below? My display function also cannot work... PLEASE help to solve my problem. */ /**************************************************/ #include #include #include #include #define false 0 #define true 1 ...

27. File Input / Output Help?    cboard.cprogramming.com

i am trying to write a program that would read data from a file and create a set of html (web) pages. How should i start? Prompt the user for a file name, which will contain artist/CD information. Artist/CD information will include: 1) artist name, 2) format (CD, Cassette, Vinyl), 3) release date, 4) label, 5) cost, 6) image file name, ...

28. file input/output    cboard.cprogramming.com

29. File Input-output    cboard.cprogramming.com

Hello, I need help with file input/output. I need to include statements in my code that will read a file input/output. Thanks for all responses! Here's my code: #include #include int main(void) { /* Variable declarations: */ double SR, CR, L, X, H; /*Function body: */ SR=0.0; CR=0.0; L= 0.0; X= 0.0; H= 0.0; printf("Enter increment value: "); scanf("%lf", ...

30. Problems with file input/output    forums.devshed.com

I am working on an assignment(C Programming). Firstly, please have a look at my question and the coding: Problem: 1. How to delete part of the entry from the address book(file)? 2. Problem retreving address as string from file, if my address contain spaces, it will only read the 1st value (eg. Road 32, it will only read Road, then 32 ...

31. Input/output file    forums.devshed.com

GDay everyone, I need to save received characters into a file and display them to the screen later on Please help. Thanks in advance Here is the code, but I can't display the right format Code: #include void display(){ FILE *file1; int numbers[30]; /* make sure it is large enough to hold all the data! */ int i,j; ////////////////////// file1 ...

32. Trying to make a file input/output class work    forums.devshed.com

Hello all, I am stuck. I have been looking at my code below for hours. I can't figure out why the file 'A.txt' is not being created. Every time I execute the application I fall into the case where the file wasnt created and output the little error message. Thanks for the help. Code: #include #include #include #include ...

33. File input/output help    forums.devshed.com

Hiya im new to c programming, and am wondering if anyone could hlep me out please. what im trying to do is read a file in and put it into a structure. here is an example file i want to read in: Code: Autumn Fishing. 21st October 2004. Margaret Mouse Skirting Board House, Mosehole, Devon. DV1 2SS Southern 9365 3 3 ...

34. input file and output files    forums.devshed.com

having trouble printing initials from a input file and printing them out to an output file. The input file has first, middle, and last name some may have a middle name and some may not, ther can also be an arbitrary number of blanks. There is onle one name per line. I am programming in C++

35. Input and Output to file    forums.devshed.com

Hi guys, I need some major help here! I'm trying to add a few things to a current text file, and i'm having some major problems. well, I have one program that creates expressions of the form num1 + num2 and puts into a file say, file.txt. Then another program is supposed to access the file, and then concatenate = num3 ...

36. C: file input and output    forums.devshed.com

Hello C problem I am having problems saving a structure to a text file. My structure is below. [code] //Hold details for all the customers struct freight{ char name[20]; char address[40]; char goods[30]; int quantity; char destination[30]; } customerDetails[20]; [\code] What is the best way to save this to a file and open it from a file and display it on ...

37. input output files    daniweb.com

// read the file from comand lien and displys it #include #include #include #include #include #include #include main(int argc, char *argv[]) { int fd ,numseats, i=0; fd = open(argv[1],O_RDWR); if(fd <0) { printf("file s% not found",argv[1]); exit(1); } while(read(fd, &numseats, sizeof(int)) > 0) printf("flight%4d: %4d seats available\n", i++, numseats); /* finished */ ...

38. Naming a output file with the same name as the input    daniweb.com

/** Find dot extension pos in the file path. * Returns dot pos or end of name if no dot * or 0 if it's not a file name */ const char* getFileNameDotPos(const char* fname) { int i, ilast, slen; char c; if (fname == 0) return 0; /* No name */ slen = (int)strlen(fname); ilast = slen - 1; for ...

39. File input output please help :(    daniweb.com

int getline(FILE *input, char *ptr, int destSize) { char temp[MAX_LEN]; /* wanted MAX_LEN of data, is there something to read? */ if (fgets(temp, MAX_LEN, input) != NULL) { size_t net_len = strlen(temp) -1; /* trim the newline/return if it's there */ if (temp[net_len] == '\n') { temp[net_len] = '\0'; } } else { /* handle the error... */ } strcpy_s(ptr, destSize, ...

40. Help in Input output C files    daniweb.com

Hi guys / girls i am new in this forum and i hope you could help me in this problem. i programmed a link list which stores some information one of them is strings and i entered them using the function gets(); instead of scanf(); to enable the program to read the space character, and at the termination of the program ...

41. file input and output    daniweb.com

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.