basically what im trying to say is i dont know why it doesnt work when there are more than 1 line in my text.txt file
Type: Posts; User: 8ball
basically what im trying to say is i dont know why it doesnt work when there are more than 1 line in my text.txt file
Im having trouble writing a loop for the fwrite functions of this code
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
char upperbyte=0;
char lowerbyte=0;
and if i need to use those numbers in variables for binary conversion, will i need to make them int?
this is what i have now, ive done a.. but dont know how to b & c
will i need to modify the while loop to get the 2 variables?
#include<stdio.h>
#include<string.h>
#include<math.h>...
ok now i want to make each line into 3 variables
a,b,c
for example
if my line is LDC 1,2 #blah blah blah
i want
a = LDC
b = 1
c =2
void breakup(char *pfile)
?
void breakup()
{
char buff[BUFSIZ];
while ( fgets( buff, BUFSIZ, pfile ) != NULL ) { /* read each line */
char *sub_string;
char *hash = strchr( buff, '#' ); /* is...
thanks alot for that
what would be the parameter if i want to place all that in a function?
this is what my code looks like now
#include <stdio.h>
#include <string.h>
char file_array[10000];
/*void
readfile(char *file)
where do i place this?
nope...
will i need linked lists?
when my input is
LDC 1,2 #444
LDC 1,2 # dkljdlkdj
Print -4 #dldkdl;
its giving me this output
LDC
1
2
LDC 1
my text.txt file
LDC 1,2 #444
LDC 1,2 #444
my program:
yes i know that
but how do i break it up?
should i use sscanf?
i want to write a program that reads and convert instructions into some numbers like for example
add 1,2
subtract 4,2
expected output is
000100010002
&
000200040002
seg fault, core dump
#include <stdio.h>
int main() {
FILE *sourceFile;
FILE *destinationFile;
char *buffer;
int n;
sourceFile = fopen("file.c", "r");
destinationFile = fopen("file2.c", "w");
ok i think i've changed the scanf codes correctly now...
#include <stdio.h>
#include <stdlib.h>
#define BUFSIZE 1000
int main(int argc, char *argv[]) {
long startLine, finishLine;
ok thanks
but im really stuck on this one
if(!(scanf("l%ld", &c) != 1 )){
startLine = c;
printError=0;
}
what do i do with the !(scanf ...
friend told me scanf is bad and told me to i need fgets + sscanf to replace it
this is what i have now
if(scanf(",%ld", &c) != 1 )
printError=1;
this is what i hav now
/*open the file
read input from user(input1, input2)
while the current line count is less than input1
read and discard this line from the file
while the...
is this the right?
FILE *fp
input1=2;
input2=5;
fp = fopen(argv[1],"r")
while(count<input1);
printf(fgets(Input, 1024, fp));
while(count>input2);
actually the printing line im not so sure
i hav varibles input1=2 and input2=5 and i want to print lines 2 to 5 from a file
is this the way to do it?
fp = fopen(argv[1],"r")
while (count>input1&&count<input2);
printf(fgets(Input, 1024,...