Skip to content

Commit

Permalink
3.18 upload
Browse files Browse the repository at this point in the history
  • Loading branch information
TGSpock123 committed Mar 18, 2024
1 parent 23bbf01 commit 8e15c76
Show file tree
Hide file tree
Showing 200 changed files with 9,502 additions and 705 deletions.
2 changes: 1 addition & 1 deletion .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file added .vs/CMake Overview
Empty file.
3 changes: 3 additions & 0 deletions .vs/ProjectSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": "x64-Debug"
}
13 changes: 13 additions & 0 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"OutputFoldersPerTargetSystem": {
"\u672C\u5730\u8BA1\u7B97\u673A": [
"out\\build\\x64-Debug",
"out\\install\\x64-Debug"
]
},
"ExpandedNodes": [
"",
"\\13"
],
"PreviewInSolutionExplorer": false
}
Binary file added .vs/cmake.db
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .vs/learn_c_primer.github.io/v16/.suo
Binary file not shown.
Binary file added .vs/learn_c_primer.github.io/v16/Browse.VC.db
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file added .vs/learn_c_primer.github.io/v17/.wsuo
Binary file not shown.
Binary file added .vs/learn_c_primer.github.io/v17/Browse.VC.db
Binary file not shown.
106 changes: 106 additions & 0 deletions .vs/learn_c_primer.github.io/v17/DocumentLayout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\TGSpock\\Documents\\GitHub\\learn_c_primer.github.io\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\TGSpock\\Documents\\GitHub\\learn_c_primer.github.io\\CMakeLists.txt||{8B382828-6202-11D1-8870-0000F87579D2}",
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:CMakeLists.txt||{8B382828-6202-11D1-8870-0000F87579D2}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\TGSpock\\Documents\\GitHub\\learn_c_primer.github.io\\13\\13.4.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:13\\13.4.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\TGSpock\\Documents\\GitHub\\learn_c_primer.github.io\\13\\13.3.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:13\\13.3.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\TGSpock\\Documents\\GitHub\\learn_c_primer.github.io\\13\\13.2.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:13\\13.2.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\TGSpock\\Documents\\GitHub\\learn_c_primer.github.io\\13\\13.1.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:13\\13.1.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 0,
"Children": [
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "CMakeLists.txt",
"DocumentMoniker": "C:\\Users\\TGSpock\\Documents\\GitHub\\learn_c_primer.github.io\\CMakeLists.txt",
"RelativeDocumentMoniker": "CMakeLists.txt",
"ToolTip": "C:\\Users\\TGSpock\\Documents\\GitHub\\learn_c_primer.github.io\\CMakeLists.txt",
"RelativeToolTip": "CMakeLists.txt",
"ViewState": "AQIAAAAAAAAAAAAAAAAQwAcAAAAOAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003109|",
"WhenOpened": "2024-03-14T10:55:32.027Z",
"IsPinned": true,
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "13.4.c",
"DocumentMoniker": "C:\\Users\\TGSpock\\Documents\\GitHub\\learn_c_primer.github.io\\13\\13.4.c",
"RelativeDocumentMoniker": "13\\13.4.c",
"ToolTip": "C:\\Users\\TGSpock\\Documents\\GitHub\\learn_c_primer.github.io\\13\\13.4.c",
"RelativeToolTip": "13\\13.4.c",
"ViewState": "AQIAAAYAAAAAAAAAAAAAABgAAAAeAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000423|",
"WhenOpened": "2024-03-17T15:32:19.207Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "13.3.c",
"DocumentMoniker": "C:\\Users\\TGSpock\\Documents\\GitHub\\learn_c_primer.github.io\\13\\13.3.c",
"RelativeDocumentMoniker": "13\\13.3.c",
"ToolTip": "C:\\Users\\TGSpock\\Documents\\GitHub\\learn_c_primer.github.io\\13\\13.3.c",
"RelativeToolTip": "13\\13.3.c",
"ViewState": "AQIAAAAAAAAAAAAAAAAAACkAAAACAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000423|",
"WhenOpened": "2024-03-15T06:08:22.529Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 4,
"Title": "13.1.c",
"DocumentMoniker": "C:\\Users\\TGSpock\\Documents\\GitHub\\learn_c_primer.github.io\\13\\13.1.c",
"RelativeDocumentMoniker": "13\\13.1.c",
"ToolTip": "C:\\Users\\TGSpock\\Documents\\GitHub\\learn_c_primer.github.io\\13\\13.1.c",
"RelativeToolTip": "13\\13.1.c",
"ViewState": "AQIAAAYAAAAAAAAAAAAAABEAAAAmAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000423|",
"WhenOpened": "2024-03-15T05:54:29.157Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 3,
"Title": "13.2.c",
"DocumentMoniker": "C:\\Users\\TGSpock\\Documents\\GitHub\\learn_c_primer.github.io\\13\\13.2.c",
"RelativeDocumentMoniker": "13\\13.2.c",
"ToolTip": "C:\\Users\\TGSpock\\Documents\\GitHub\\learn_c_primer.github.io\\13\\13.2.c",
"RelativeToolTip": "13\\13.2.c",
"ViewState": "AQIAACQAAAAAAAAAAAAAABwAAAAaAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000423|",
"WhenOpened": "2024-03-14T13:41:17.799Z",
"EditorCaption": ""
}
]
}
]
}
]
}
Binary file added .vs/learn_c_primer.github.io/v17/Solution.VC.db
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .vs/slnx.sqlite
Binary file not shown.
10 changes: 10 additions & 0 deletions .vs/tasks.vs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"version": "0.2.1",
"tasks": [
{
"taskLabel": "\u4EFB\u52A1-learn_c_primer.github",
"appliesTo": "/",
"type": "launch"
}
]
}
Binary file added 13/13.1
Binary file not shown.
38 changes: 38 additions & 0 deletions 13/13.1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char * argv[])
{
int ch;
FILE * fp;
unsigned long count =0;

if (argc != 2)
{
printf ("usage: %s filename\n", argv[0]);
exit (EXIT_FAILURE);
}
else;

if (!(fp = fopen(argv[1], "r")))
{
printf ("can't open %s\n", argv[1]);
exit (EXIT_FAILURE);
}
else;

while ((ch = getc(fp)) != EOF)
{
putc (ch, stdout);
count ++;
}

if (fclose(fp))
{
printf("error in closing file %s\n", argv[1]);
}
else;

printf ("file %s has %lu characters\n", argv[1], count);

return 0;
}
Binary file added 13/13.2
Binary file not shown.
54 changes: 54 additions & 0 deletions 13/13.2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define LEN 40

int main (int argc, char * argv[])
{
FILE * in, * out;
int ch;
char name[LEN];
int count = 0;

if (argc < 2)
{
fprintf (stderr, "usage: %s filename\n", argv[0]);
exit (EXIT_FAILURE);
}
else;

if (!(in = fopen (argv[1], "r")))
{
fprintf (stderr, "i couldn't open the file \"%s\"\n", argv[1]);
exit (EXIT_FAILURE);
}
else;

strncpy (name, argv[1], LEN - 5);
name[LEN - 5] = '\0';
strcat (name, ".red");

if (!(out = fopen (name, "w")))
{
fprintf (stderr, "can't create oupput file. \n");
exit (3);
}
else;

while ((ch = getc(in)) != EOF)
{
if (count ++ % 3 == 0)
{
putc (ch, out);
}
else;
}

if (fclose(in) || fclose(out))
{
fprintf(stderr, "error in closing files. \n");
}
else;

return 0;
}
46 changes: 46 additions & 0 deletions 13/13.3.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 41

int main(void)
{
FILE * fp;
char word[MAX];

//fopen()第二个参数作用:
//单独使用r时为只读, 单独使用w或a时为只写.
//r+会把指针摆到开头写, w+会把文件清空写, a+会接着文件屁股写.
//例如 源文件: 012345678 输入:910jq
//r+输出: 910jq5678 w+输出: 910jq a+输出: 012345678910jq
if(!(fp = fopen("wordy", "a+")))
{
fprintf(stdout, "Can't open \"wordy\" file. \n");
exit(EXIT_FAILURE);
}
else;

puts("Enter words to add to the file; press the #");
puts("key at the beginning of a line to terminate.");

while((fscanf(stdin, "%40s", word)) && (word[0] != '#'))
{
fprintf(fp, "%s\n", word);
}

puts("File contents: ");
rewind(fp);

while(fscanf(fp, "%s", word) == 1)
{
puts(word);
}

if (fclose(fp))
{
fprintf(stderr, "error closing file\n");
}
else;

return 0;
}
Binary file added 13/13.3.exe
Binary file not shown.
37 changes: 37 additions & 0 deletions 13/13.4.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include <stdio.h>
#include <stdlib.h>
#define CTRL_Z '\032'
#define SLEN 81
int main(void)
{
char file[SLEN];
char ch;
FILE * fp;
long count, last;

fputs("Enter the name of file to be processed: \n", stdout);
scanf("%80s", file);
if(!(fp = fopen(file, "rb")))
{
printf("revers can't open %s\n", file);
exit(EXIT_FAILURE);
}

fseek(fp, 0L, SEEK_END);
last = ftell(fp);

for (count = 1L; count <= last; count++)
{
fseek(fp, -count, SEEK_END);
ch = getc(fp);
if (ch != CTRL_Z && ch != '\r')
{
putchar(ch);
}
}

putchar('\n');
fclose(fp);

return 0;
}
Binary file added 13/13.4.exe
Binary file not shown.
1 change: 1 addition & 0 deletions 13/test132
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
So even Eddy came oven ready.
1 change: 1 addition & 0 deletions 13/test132.red
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Send money
5 changes: 1 addition & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@ set(CMAKE_CXX_STANDARD 14)
include_directories(9)

add_executable(
C_primer
12/12.25.c
12/s_gets.c
12/s_gets.h
C_primer "13/13.4.c"
)
15 changes: 15 additions & 0 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": ""
}
]
}
Loading

0 comments on commit 8e15c76

Please sign in to comment.