15,551 Topics

Member Avatar for
Member Avatar for visakh_Here

Iam beginer in this field. While trying a code to implement fprintf & fscanf, iam getting errors. Please help to explain the cause of error. Code Snippet ================ #include <stdio.h> int main () { FILE *fp; int num; char sstr[100]; fp = fopen("myText.txt", "w"); fprintf(fp,"%d %s",9898,"visakh"); /*sscanf(fp, "%f %s",&ffloat,sstr); printf("Float …

Member Avatar for mathematician
0
115
Member Avatar for khan shahid
Member Avatar for Van_1

Hi. I just got a problem running my graphics program written using C language in DOS Box. There may seem a problem using the graphics.h running through DOSBox in Windows 7 ultimate 64bit. The program just flickers fasts when I run it. I know that my program is correct and …

Member Avatar for N1GHTS
0
401
Member Avatar for sumdumhoe

Apperently there is an undeclared identfiier "stdprn". Please help /* PRINT_IT.C-This program prints a listing with line numbers! */ #include <stdio.h> void do_heading(char *filename); int line, page; main( int argv, char *argc[] ) { char buffer[256]; FILE *fp; if( argv < 2 ) { fprintf(stderr, "\nProper Usage is : "); …

Member Avatar for Ancient Dragon
0
196
Member Avatar for kent.johnstone_1

Is this a "typedef" problem? This is the definition in one file. typedef BYTE SOCKET; //Socket descriptor BYTE is defined elsewhere as type char. (I made sure the file where SOCKET is assigned a type is included in the file the problem is in.) This is one place it is …

Member Avatar for kent.johnstone_1
0
317
Member Avatar for mexabet

I'm creating a basic C program that I want to accept both positive and negative inputs. However, as it is it doesn't accept negative inputs. Any help on how to fix it will be much appreciated. here is the code: int main(void){ // Here we declare integer and floating point …

Member Avatar for mexabet
0
305
Member Avatar for shilpi.rai.77

i want hexadecimal addition program without converting it into any other base n without use of %x.....

Member Avatar for kent.johnstone_1
0
122
Member Avatar for Adox

Hello guys, i have a simple doubt. One problem I am not getting. Read a text file and add a line at the end of it. '-' Does anyone have any idea?

Member Avatar for Ancient Dragon
0
48
Member Avatar for NardCake

Hello! This is mainly a curiousity question, I may apply it to something in the near future though just as an added twist... :D So essentially I want to figure out how a progress indicator is created in the shell. For example with wget or something you may see a …

Member Avatar for L7Sqr
1
193
Member Avatar for ahmad313

Write a C program to create 3 child processes which read from 3 different files and write to the parent process using pipes. Each child should wait a random amount of time (3 -10 seconds) between writing each 50 characters. The father should read from pipes and write everything he …

Member Avatar for rubberman
-1
144
Member Avatar for Neelam_1
Member Avatar for Neelam_1
0
201
Member Avatar for mohamed.talaat.1217

**I have a struct of students that written to a file all what i want is intial the array with values from the file using any method , the aim is to put the struct values into array to help sorting process the code gives me punch an kick any …

Member Avatar for mohamed.talaat.1217
0
291
Member Avatar for Elvi

Hello! I have a exercise about matrices. here is the question: is given a square matrix [M] [N] which determines the amount of each column. Thank u!

Member Avatar for Ancient Dragon
0
135
Member Avatar for hey_shishir
Member Avatar for COKEDUDE

Can someone please tell me what is wrong with strcmp? I don't understand why I am getting a segmentation fault when comparing array of strings and string. char *strings[100]; char nam[100]; int g = 0; while (fscanf(pFile, "%s %d", nam, &val) !=EOF) { strings[k] = nam; printf(" string is %s …

Member Avatar for Rolf_2
0
268
Member Avatar for parth2911

** # i am tring to merge two array but every time its display first array proparly but in second array its only display last element....thx....# ** #include<stdio.h> #include<conio.h> void main() { int a[10],b[10],i,j,c,d,e; clrscr(); printf("how many number in first array="); scanf("%d",&c); printf("how many number in second array="); scanf("%d",&d); printf("\nenter …

Member Avatar for parth2911
0
251
Member Avatar for zaxo311

So here's my problem I have inner structure inside of client. How can I know while reading from txt file that I'm reading item data or client data for my list? struct item { char item_name[30]; char item_state[30]; float item_price; char item_status[30]; float item_price_if_not; struct item *next; }; struct client …

Member Avatar for zaxo311
0
9K
Member Avatar for COKEDUDE

Can someone please tell me the the maximum and minimum of int, long int, long long int, double, float, and anything bigger than that? And also how to calculate this?

Member Avatar for rubberman
0
97
Member Avatar for srao1

Here is the mex code I wrote to read in a tab-delimited file. The mex file got created but it causes my MATLAB to end abruptly and give the following error. Can anyone help me where I am going wrong? Please let me know if any further information is required …

Member Avatar for Ancient Dragon
0
374
Member Avatar for srao1

I am unable to convert my C file to mex file. Here is the C file I wrote to read in a tab-delimited file. The C program in running, but I am not able to successfully convert it to a mex file. I have also pasted the mex file I …

Member Avatar for srao1
0
566
Member Avatar for srao1

I am trying to read in a large tab-delimited file which has 16 columns and about five lac rows. The first column is a date string. TThe second contains integers and so on. However I am not able to get the arrays correctly. Also how can one ignore three header …

Member Avatar for Ancient Dragon
0
6K
Member Avatar for parth2911

**i am tring to this way but answer is not write....thx...** #include<stdio.h> #include<conio.h> void main() { float a[10],m; int i,j,n,t; clrscr(); printf("how many number in array\n"); scanf("%d",&n); printf("enter %d number\n",n); for(i=1;i<=n;i++) { scanf("%f",&a[i]); } for(i=1;i<=n;i++) { for(j=i+1;j<=n;j++) { if(a[i]>a[j]) { t=a[i]; a[i]=a[j]; a[j]=t; } } } if(n%2==0) { m=a[(n/2)+((n/2)+1)]/2; } …

Member Avatar for parth2911
0
200
Member Avatar for yann.bohbot.9

I'm new to C and I'm trying to convert decimal to binary. The result is giving me an inverse number of what's required. I tried to apply modulo on the result like I saw on other forums but I still get the same result. Any help? #include<stdio.h> int main() { …

Member Avatar for Banfa
0
143
Member Avatar for mayankjoin
Member Avatar for zaxo311

I'm trying to make make project for my programming class. All that's left is deleting elements and editing elements. Basicaly my question is how would I do it for my inner list? Or how would I delete single client from list? Would I first have to free the client's inner …

Member Avatar for zaxo311
0
427
Member Avatar for COKEDUDE

I am trying to use fscanf to read a file. When fscanf hits a newline I would like it to do one thing and when it hits a space I would like to do something else. Is this hopefully possible? char nam[100]; while (fscanf(pFile, "%s", nam) !=EOF) { if(space) //do …

Member Avatar for rubberman
0
1K
Member Avatar for COKEDUDE

Which file readers in C can handle reading an inconsistent file? Sometimes the file is "word number" and other times it is just "word". Like this. bob 456 echo cat dog 1101 peacock 300 This is what I tried with fscanf. I am surprised it worked. I didn't think fscanf …

Member Avatar for deceptikon
0
157
Member Avatar for yann.bohbot.9

Hey there, I'm having a problem and I tried several times to solve this problem maybe you could help. I need to modify the program below so that it asks the user to enter any number other than the number equal to the number of times they've been asked to …

Member Avatar for Banfa
0
182
Member Avatar for zaxo311

Im writing project for my programming lessons and right now got some problems with output from function AddItemToClient, basicaly its mainly with date, in first node its correct one but after this its just random. Could someone explain what I'm doing wrong here? #include <stdlib.h> #include <time.h> #include <string.h> #include …

Member Avatar for zaxo311
0
934
Member Avatar for COKEDUDE

I've seen a few different ways to convert a string to ascii and I was wondering what is the best way and why. char str[100]; int i=0; printf("Enter any string: "); scanf("%s",str); printf("ASCII values of each characters of given string: "); while(str[i]) printf("%d ",str[i++]); ----------------------------------------------------------------------------- int main() { char *s="hello"; …

Member Avatar for Ancient Dragon
0
179

The End.